Home

Awesome

<div align=center> <img width=400 src="https://github.com/yangbisheng2009/nsfw-resnet/blob/master/image/nsfw_logo.jpg" > </div>

English | 中文版

NSFW

NSFW - not safe for work

Python 3.7 Pytorch 1.4.0 cuDNN 7.3.1 License CC BY-NC

Description

Trained on 600,000 labled pictures:

Requeriments

pytorch 1.0+
If you want pytorch 0.4, please download V1 release.

Usage

#train
python train.py --model resnet101 --epochs 90 --batch-size 512 --checkpoint ./checkpoint --data-dir ./data

#test
python test_confusion_matrix.py

#predict
python predict --model resnet101 --checkpoint ./checkpoint/x

#if your machine has connected to the internet and you dosen't want to download the image to your disk
cat urls.txt | python predict_url.py

Training data source

Special thanks to the nsfw_data_scraper for the training data. If you're interested in a more detailed analysis of types of NSFW images, you could probably use this repo code with this data.
If you want make better result.Contact me.I can provide you the best training data.

Current status

<div align=left> <img width=700 src="https://github.com/yangbisheng2009/nsfw-resnet/blob/master/image/test_confusion_matrix.jpg" > </div>

Sexy and porn is a little similar.In my view,it does'nt matter.  

SEXY

<div align=left> <img width=200 height=250 src="https://github.com/yangbisheng2009/nsfw-resnet/blob/master/image/sexy_demo.jpg" > </div> &emsp; &emsp;

NETURAL

<div align=left> <img width=200 height=250 src="https://github.com/yangbisheng2009/nsfw-resnet/blob/master/image/netural_demo.jpg" > </div>

Detail

I have tried various methods include some pretrained models like resnet/inceptionv3 and data augumentation and finetuing.

Here are some tips which make a greate effect to the final result:

Thanks

Thanks for my wife FeiFei Li. She gave me lots of encouragement. And made the beautiful logo for NSFW preject.
Thanks for my workmate Kuai Li. He gave me lots of good suggestion.

Join us

If you have good points.Join us!

References

https://github.com/GantMan/nsfw_model