Binarybardakshat
commited on
Commit
•
d9dea86
1
Parent(s):
747888d
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,56 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
datasets:
|
4 |
+
- abdulmananraja/real-life-violence-situations
|
5 |
+
tags:
|
6 |
+
- image-classification
|
7 |
+
- vision
|
8 |
+
- harassment-detection
|
9 |
+
license: apache-2.0
|
10 |
+
---
|
11 |
+
|
12 |
+
# RKSHT Harassment Detection Model
|
13 |
+
|
14 |
+
## Model Description
|
15 |
+
|
16 |
+
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.
|
17 |
+
|
18 |
+
## Intended Use
|
19 |
+
|
20 |
+
This model is designed for use in applications requiring harassment detection through visual data, including:
|
21 |
+
|
22 |
+
- Workplace and public safety monitoring
|
23 |
+
- Real-time CCTV surveillance
|
24 |
+
- Automated alert systems
|
25 |
+
|
26 |
+
## Model accuracy
|
27 |
+
|
28 |
+
The RKSHT model has been fine-tuned with high accuracy for distinguishing harassment behavior.
|
29 |
+
|
30 |
+
## How to Use
|
31 |
+
|
32 |
+
Here’s an example of how to use the RKSHT Harassment Detection model for image classification:
|
33 |
+
|
34 |
+
```python
|
35 |
+
import torch
|
36 |
+
from transformers import ViTForImageClassification, ViTFeatureExtractor
|
37 |
+
from PIL import Image
|
38 |
+
|
39 |
+
# Load the model and feature extractor
|
40 |
+
model = ViTForImageClassification.from_pretrained('Binarybardakshat/RKSHT')
|
41 |
+
feature_extractor = ViTFeatureExtractor.from_pretrained('Binarybardakshat/RKSHT')
|
42 |
+
|
43 |
+
# Load an image
|
44 |
+
image = Image.open('image.jpg')
|
45 |
+
|
46 |
+
# Preprocess the image
|
47 |
+
inputs = feature_extractor(images=image, return_tensors="pt")
|
48 |
+
|
49 |
+
# Perform inference
|
50 |
+
with torch.no_grad():
|
51 |
+
outputs = model(**inputs)
|
52 |
+
logits = outputs.logits
|
53 |
+
predicted_class_idx = logits.argmax(-1).item()
|
54 |
+
|
55 |
+
# Print the predicted class
|
56 |
+
print("Predicted class:", model.config.id2label[predicted_class_idx])
|