All Projects → GantMan → Nsfw_model

GantMan / Nsfw_model

Licence: other
Keras model of NSFW detector

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Nsfw model

Solaris
CosmiQ Works Geospatial Machine Learning Analysis Toolkit
Stars: ✭ 290 (-56.52%)
Mutual labels:  machinelearning
Awesome Cybersecurity Datasets
A curated list of amazingly awesome Cybersecurity datasets
Stars: ✭ 380 (-43.03%)
Mutual labels:  machinelearning
Monk v1
Monk is a low code Deep Learning tool and a unified wrapper for Computer Vision.
Stars: ✭ 480 (-28.04%)
Mutual labels:  machinelearning
Tensorwatch
Debugging, monitoring and visualization for Python Machine Learning and Data Science
Stars: ✭ 3,191 (+378.41%)
Mutual labels:  machinelearning
Text summurization abstractive methods
Multiple implementations for abstractive text summurization , using google colab
Stars: ✭ 359 (-46.18%)
Mutual labels:  machinelearning
Onepanel
The open and extensible integrated development environment (IDE) for computer vision with built-in modules for model building, automated labeling, data processing, model training, hyperparameter tuning and workflow orchestration.
Stars: ✭ 428 (-35.83%)
Mutual labels:  machinelearning
2018 Machinelearning Lectures Esa
Machine Learning Lectures at the European Space Agency (ESA) in 2018
Stars: ✭ 280 (-58.02%)
Mutual labels:  machinelearning
Machinelearning
My blogs and code for machine learning. http://cnblogs.com/pinard
Stars: ✭ 5,984 (+797.15%)
Mutual labels:  machinelearning
Articles
A repository for the source code, notebooks, data, files, and other assets used in the data science and machine learning articles on LearnDataSci
Stars: ✭ 350 (-47.53%)
Mutual labels:  machinelearning
Treelstm.pytorch
Tree LSTM implementation in PyTorch
Stars: ✭ 476 (-28.64%)
Mutual labels:  machinelearning
Pytorch Es
Evolution Strategies in PyTorch
Stars: ✭ 314 (-52.92%)
Mutual labels:  machinelearning
Homemade Machine Learning
🤖 Python examples of popular machine learning algorithms with interactive Jupyter demos and math being explained
Stars: ✭ 18,594 (+2687.71%)
Mutual labels:  machinelearning
Simple Ocr Opencv
A simple python OCR engine using opencv
Stars: ✭ 453 (-32.08%)
Mutual labels:  machinelearning
Retentioneering Tools
Retentioneering: product analytics, data-driven customer journey map optimization, marketing analytics, web analytics, transaction analytics, graph visualization, and behavioral segmentation with customer segments in Python. Opensource analytics, predictive analytics over clickstream, sentiment analysis, AB tests, machine learning, and Monte Carlo Markov Chain simulations, extending Pandas, Networkx and sklearn.
Stars: ✭ 291 (-56.37%)
Mutual labels:  machinelearning
Nsfwjs
NSFW detection on the client-side via TensorFlow.js
Stars: ✭ 5,223 (+683.06%)
Mutual labels:  machinelearning
Code
Compilation of R and Python programming codes on the Data Professor YouTube channel.
Stars: ✭ 287 (-56.97%)
Mutual labels:  machinelearning
Actionai
custom human activity recognition modules by pose estimation and cascaded inference using sklearn API
Stars: ✭ 404 (-39.43%)
Mutual labels:  machinelearning
Nudenet
Neural Nets for Nudity Detection and Censoring
Stars: ✭ 642 (-3.75%)
Mutual labels:  machinelearning
Deeplearning
深度学习入门教程, 优秀文章, Deep Learning Tutorial
Stars: ✭ 6,783 (+916.94%)
Mutual labels:  machinelearning
Bigslice
A serverless cluster computing system for the Go programming language
Stars: ✭ 469 (-29.69%)
Mutual labels:  machinelearning
NSFW Detector logo

NSFW Detection Machine Learning Model

All Contributors

Trained on 60+ Gigs of data to identify:

  • drawings - safe for work drawings (including anime)
  • hentai - hentai and pornographic drawings
  • neutral - safe for work neutral images
  • porn - pornographic images, sexual acts
  • sexy - sexually explicit images, not pornography

This model powers NSFW JS - More Info

Current Status:

93% Accuracy with the following confusion matrix, based on Inception V3. nsfw confusion matrix

Review the _art folder for previous incarnations of this model.

Requirements:

keras (tested with versions > 2.0.0) tensorflow >= 2.1.0

Usage

For programmatic use of the library.

from nsfw_detector import predict
model = predict.load_model('./nsfw_mobilenet2.224x224.h5')

# Predict single image
predict.classify(model, '2.jpg')
# {'2.jpg': {'sexy': 4.3454722e-05, 'neutral': 0.00026579265, 'porn': 0.0007733492, 'hentai': 0.14751932, 'drawings': 0.85139805}}

# Predict multiple images at once
predict.classify(model, ['/Users/bedapudi/Desktop/2.jpg', '/Users/bedapudi/Desktop/6.jpg'])
# {'2.jpg': {'sexy': 4.3454795e-05, 'neutral': 0.00026579312, 'porn': 0.0007733498, 'hentai': 0.14751942, 'drawings': 0.8513979}, '6.jpg': {'drawings': 0.004214506, 'hentai': 0.013342537, 'neutral': 0.01834045, 'porn': 0.4431829, 'sexy': 0.5209196}}

# Predict for all images in a directory
predict.classify(model, '/Users/bedapudi/Desktop/')

If you've installed the package or use the command-line this should work, too...

# a single image
nsfw-predict --saved_model_path mobilenet_v2_140_224 --image_source test.jpg

# an image directory
nsfw-predict --saved_model_path mobilenet_v2_140_224 --image_source images

# a single image (from code/CLI)
python3 nsfw_detector/predict.py --saved_model_path mobilenet_v2_140_224 --image_source test.jpg

Download

Please feel free to use this model to help your products!

If you'd like to say thanks for creating this, I'll take a donation for hosting costs.

Latest Models Zip (v1.1)

https://github.com/GantMan/nsfw_model/releases/tag/1.1.0

Original Inception v3 Model (v1.0)

Original Mobilenet v2 Model (v1.0)

PyTorch Version

Kudos to the community for creating a PyTorch version with resnet! https://github.com/yangbisheng2009/nsfw-resnet

Training Folder Contents

Simple description of the scripts used to create this model:

  • inceptionv3_transfer/ - Folder with all the code to train the Keras based Inception v3 transfer learning model. Includes constants.py for configuration, and two scripts for actual training/refinement.
  • mobilenetv2_transfer/ - Folder with all the code to train the Keras based Mobilenet v2 transfer learning model.
  • visuals.py - The code to create the confusion matrix graphic
  • self_clense.py - If the training data has significant inaccuracy, self_clense helps cross validate errors in the training data in reasonable time. The better the model gets, the better you can use it to clean the training data manually.

e.g.

cd training
# Start with all locked transfer of Inception v3
python inceptionv3_transfer/train_initialization.py

# Continue training on model with fine-tuning
python inceptionv3_transfer/train_fine_tune.py

# Create a confusion matrix of the model
python visuals.py

Extra Info

There's no easy way to distribute the training data, but if you'd like to help with this model or train other models, get in touch with me and we can work together.

Advancements in this model power the quantized TFJS module on https://nsfwjs.com/

My twitter is @GantLaborde - I'm a School Of AI Wizard New Orleans. I run the twitter account @FunMachineLearn

Learn more about me and the company I work for.

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 need React Native, Elixir, AI, or Machine Learning work, check in with us at Infinite Red, who make all these experiments possible. We're an amazing software consultancy worldwide!

Cite

@misc{man,
  title={Deep NN for NSFW Detection},
  url={https://github.com/GantMan/nsfw_model},
  journal={GitHub},
  author={Laborde, Gant}}

Contributors

Thanks goes to these wonderful people (emoji key):


Gant Laborde

💻 📖 🤔

Bedapudi Praneeth

💻 🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

Changes

1.1.1

  • break out numpy (nd array) function
  • remove classic app run modes for argparse
  • one more example in README for running
  • turn down verbosity in image load via file
  • fix requirements for clean system (needs PIL)

1.1.0

  • update to tensorflow 2.1.0 and updated mobilenet-based model

1.0.0

  • initial creation
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].