File size: 1,754 Bytes
d9dea86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
language: en
datasets:
- abdulmananraja/real-life-violence-situations
tags:
- image-classification
- vision
- harassment-detection
license: apache-2.0
---

# RKSHT Harassment Detection Model

## Model Description

This is a custom Vision Transformer (ViT) model fine-tuned for detecting instances of harassment in public and workplace environments. The model is built on [google/vit-base-patch16-224-in21k](https://huggingface.co/google/vit-base-patch16-224-in21k) and trained on a dataset tailored for harassment detection, classifying images into 'harassment' or 'non-harassment' categories.

## Intended Use

This model is designed for use in applications requiring harassment detection through visual data, including:

- Workplace and public safety monitoring
- Real-time CCTV surveillance
- Automated alert systems

## Model accuracy

The RKSHT model has been fine-tuned with high accuracy for distinguishing harassment behavior.

## How to Use

Here’s an example of how to use the RKSHT Harassment Detection model for image classification:

```python
import torch
from transformers import ViTForImageClassification, ViTFeatureExtractor
from PIL import Image

# Load the model and feature extractor
model = ViTForImageClassification.from_pretrained('Binarybardakshat/RKSHT')
feature_extractor = ViTFeatureExtractor.from_pretrained('Binarybardakshat/RKSHT')

# Load an image
image = Image.open('image.jpg')

# Preprocess the image
inputs = feature_extractor(images=image, return_tensors="pt")

# Perform inference
with torch.no_grad():
    outputs = model(**inputs)
    logits = outputs.logits
    predicted_class_idx = logits.argmax(-1).item()

# Print the predicted class
print("Predicted class:", model.config.id2label[predicted_class_idx])