Instructions to use AdamCodd/vit-base-nsfw-detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use AdamCodd/vit-base-nsfw-detector with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-classification', 'AdamCodd/vit-base-nsfw-detector'); - Transformers
How to use AdamCodd/vit-base-nsfw-detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="AdamCodd/vit-base-nsfw-detector") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("AdamCodd/vit-base-nsfw-detector") model = AutoModelForImageClassification.from_pretrained("AdamCodd/vit-base-nsfw-detector") - Notebooks
- Google Colab
- Kaggle
Model mislabels black and white images as SFW.
#7
by justbanana - opened
Amongst ~400 pictures, with equal amount of SFW and NSFW, around 10 images were mislabeled, 6 being not-blatant NSFW and 4 being blatant NSFW, but in B&W. Anyone else found more weaknesses?
That seems well within the expected accuracy (0.965). I recommend adjusting the NSFW cutoff point according to your use case as it can perform better than the 0.5 default.