Giter Club home page Giter Club logo

nsfw-resnet's Introduction

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:

  • porn - pornography images
  • hentai - hentai images, but also includes pornographic drawings
  • sexy - sexually explicit images, but not pornography. Think nude photos, playboy, bikini, etc.
  • neutral - safe for work neutral images of everyday things and people
  • drawings - safe for work drawings (including anime)

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

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

SEXY

   

NETURAL

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:

  • Make batch size bigger.(the bigger the better since I make it 512 with my p40)
  • Use pretrained model.(you can use torchvision. pretrained model can help your model convergence more faster)
  • Lock some layer and finetune FC.(after train_init.py then lock some layer just finetune the FC)
  • Adjust learning rate.(make lr dynamic when training in order to get saddle point)
  • Select appropriate pretrained model.(I choose resnet101 since it receive better result than resnet50 or inceptionv3)

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! You can attach me by:
[email protected]
https://twitter.com/yangbisheng2009

References

https://github.com/GantMan/nsfw_model

nsfw-resnet's People

Contributors

yangbisheng2009 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.