├── Inference_example.ipynb ├── Output_example.png ├── README.md ├── ResNet50_nsfw_model.pth └── images ├── 1.jpg ├── 2.jpg ├── 3.jpg ├── 4.jpg └── 5.jpg /Output_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emiliantolo/pytorch_nsfw_model/60cb1d64c89f86cfa362dd05402c4e621d108b95/Output_example.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PyTorch model for NSFW detection 2 | 3 | ## Description 4 | 5 | This constains a PyTorch model for NSFW images detection. 6 | It's based on a ResNet50 neural network trained on ~250k images (~40 gb of data) 7 | 8 | The dataset contains images of the following categories: 9 | - `porn` - pornography images 10 | - `hentai` - hentai images and pornographic drawings 11 | - `sexy` - sexually explicit images, but not pornography 12 | - `neutral` - safe for work neutral images 13 | - `drawings` - safe for work drawings and anime 14 | 15 | ## Usage example 16 | 17 | The repository contains a Jupiter notebook with an example code for perfoming simple inference on images to make predictions. 18 | The directory `images` constains some sample images for running the example. 19 | 20 | ### Prerequisites 21 | 22 | Tested on Debian 9 23 | 24 | ``` 25 | matplotlib 26 | numpy 27 | pillow 28 | pytorch 29 | torchvision 30 | ``` 31 | 32 | ### Run 33 | 34 | Enter a shell and type the following commands: 35 | 36 | ```shell 37 | $ git clone https://github.com/emiliantolo/pytorch_nsfw_model.git 38 | $ cd pytorch_nsfw_model 39 | $ jupyter notebook Inference_example.ipynb 40 | ``` 41 | 42 | ### Output 43 | 44 | The output will follow this line: 45 | 46 | ![Recordit GIF](https://raw.githubusercontent.com/emiliantolo/pytorch_nsfw_model/master/Output_example.png) 47 | -------------------------------------------------------------------------------- /ResNet50_nsfw_model.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emiliantolo/pytorch_nsfw_model/60cb1d64c89f86cfa362dd05402c4e621d108b95/ResNet50_nsfw_model.pth -------------------------------------------------------------------------------- /images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emiliantolo/pytorch_nsfw_model/60cb1d64c89f86cfa362dd05402c4e621d108b95/images/1.jpg -------------------------------------------------------------------------------- /images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emiliantolo/pytorch_nsfw_model/60cb1d64c89f86cfa362dd05402c4e621d108b95/images/2.jpg -------------------------------------------------------------------------------- /images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emiliantolo/pytorch_nsfw_model/60cb1d64c89f86cfa362dd05402c4e621d108b95/images/3.jpg -------------------------------------------------------------------------------- /images/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emiliantolo/pytorch_nsfw_model/60cb1d64c89f86cfa362dd05402c4e621d108b95/images/4.jpg -------------------------------------------------------------------------------- /images/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emiliantolo/pytorch_nsfw_model/60cb1d64c89f86cfa362dd05402c4e621d108b95/images/5.jpg --------------------------------------------------------------------------------