RealFalconsAI
commited on
Commit
•
11d4610
1
Parent(s):
73ae1ec
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,68 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
# Model Card: Fine-Tuned Vision Transformer (ViT) for NSFW Image Classification
|
5 |
+
|
6 |
+
## Model Description
|
7 |
+
|
8 |
+
The **Fine-Tuned Vision Transformer (ViT)** is a variant of the transformer encoder architecture, similar to BERT, that has been adapted for image classification tasks. This specific model, named "google/vit-base-patch16-224-in21k," is pre-trained on a substantial collection of images in a supervised manner, leveraging the ImageNet-21k dataset. The images in the pre-training dataset are resized to a resolution of 224x224 pixels, making it suitable for a wide range of image recognition tasks.
|
9 |
+
|
10 |
+
During the pre-training phase, the model underwent training for fewer than 20 epochs with a batch size of 16. This training process involved learning valuable visual features from the ImageNet-21k dataset to create a robust foundation for subsequent fine-tuning on specific tasks.
|
11 |
+
|
12 |
+
## Intended Uses & Limitations
|
13 |
+
|
14 |
+
### Intended Uses
|
15 |
+
- **NSFW Image Classification**: The primary intended use of this model is for the classification of NSFW (Not Safe for Work) images. It has been fine-tuned for this purpose, making it suitable for filtering explicit or inappropriate content in various applications.
|
16 |
+
|
17 |
+
### How to use
|
18 |
+
Here is how to use this model to classifiy an image based on 1 of 2 classes (normal,nsfw):
|
19 |
+
|
20 |
+
```markdown
|
21 |
+
|
22 |
+
# Use a pipeline as a high-level helper
|
23 |
+
from transformers import pipeline
|
24 |
+
|
25 |
+
classifier = pipeline("image-classification", model="RealFalconsAI/nsfw_image_detection")
|
26 |
+
classifier(image)
|
27 |
+
|
28 |
+
```
|
29 |
+
|
30 |
+
<hr>
|
31 |
+
|
32 |
+
``` markdown
|
33 |
+
|
34 |
+
# Load model directly
|
35 |
+
from transformers import AutoModelForImageClassification, ViTImageProcessor
|
36 |
+
|
37 |
+
model = AutoModelForImageClassification.from_pretrained("RealFalconsAI/nsfw_image_detection")
|
38 |
+
processor = ViTImageProcessor.from_pretrained('RealFalconsAI/nsfw_image_detection')
|
39 |
+
with torch.no_grad():
|
40 |
+
inputs = processor(images=<image>, return_tensors="pt")
|
41 |
+
outputs = model(**inputs)
|
42 |
+
logits = outputs.logits
|
43 |
+
|
44 |
+
predicted_label = logits.argmax(-1).item()
|
45 |
+
model.config.id2label[predicted_label]
|
46 |
+
|
47 |
+
```
|
48 |
+
|
49 |
+
<hr>
|
50 |
+
|
51 |
+
### Limitations
|
52 |
+
- **Specialized Task Fine-Tuning**: While the model is adept at NSFW image classification, its performance may vary when applied to other tasks. Users interested in employing this model for different tasks should explore fine-tuned versions available in the model hub for optimal results.
|
53 |
+
|
54 |
+
## Training Data
|
55 |
+
|
56 |
+
The model's training data includes a proprietary dataset comprising approximately 80,000 images. This dataset encompasses a significant amount of variability and consists of two distinct classes: "normal" and "nsfw." The training process on this data aimed to equip the model with the ability to distinguish between safe and explicit content effectively.
|
57 |
+
|
58 |
+
**Note:** It's essential to use this model responsibly and ethically, adhering to content guidelines and applicable regulations when implementing it in real-world applications, particularly those involving potentially sensitive content.
|
59 |
+
|
60 |
+
For more details on model fine-tuning and usage, please refer to the model's documentation and the model hub.
|
61 |
+
|
62 |
+
## References
|
63 |
+
|
64 |
+
- [Hugging Face Model Hub](https://huggingface.co/models)
|
65 |
+
- [Vision Transformer (ViT) Paper](https://arxiv.org/abs/2010.11929)
|
66 |
+
- [ImageNet-21k Dataset](http://www.image-net.org/)
|
67 |
+
|
68 |
+
**Disclaimer:** The model's performance may be influenced by the quality and representativeness of the data it was fine-tuned on. Users are encouraged to assess the model's suitability for their specific applications and datasets.
|