Git Product home page Git Product logo

nsfwsqueezenet's Introduction

NsfwSqueezenet

Caffe Squeezenet model for binary classification of pornographic/non-pornographic material

Important Update

The model herein, especially the accuracies shown, are not accurate. Though I'm not quite sure how, my best guess is that the model is heavily overfit. Since publishing this, I have tested this model against small sets of plain nudity and other pornographic images and the model does extremely poorly. Yahoo NSFW drops compared to the stats below as well, just ot as significantly as this model. Live and learn! Anyway I'm archiving this cause of it. Just be advised.

Original Readme

The model has a single output, which consists of float values indicating the probability of the input belonging to one of two classes, ranging from 0.0 to 1.0. The first class, 0, is non-pornography, and the second class, 1, is pornography. Therefore, you can simply take the second index of the output (class 1 probability) as your result.

This project was inspired by Open NSFW. Open NSFW has excellent accuracy but is computationally expensive. While we don't quite meet the accuracy of OpenNSFW... This model is now slightly more accurate than Yahoo's Open NSFW. As a bonus, this model executes ~3x faster. On modern hardware, I can run classification with this model at ~3msec on the CPU, including preprocessing.

On a set of 24,000 images (12K per class), the final results for this model vs Yahoo's are:

Squeezenet Cutoff = 0.895677871187031
Classifier with type Squeezenet classified pornographic images with an accuracy of 99.2422285369844%.
Classifier with type Squeezenet classified non-pornographic images with an accuracy of 98.9925083957634%.
Classifier with type Squeezenet has an overall accuracy of 99.1173684663739%.

ResNet Cutoff = 0.3
Classifier with type ResNet classified pornographic images with an accuracy of 98.622233703608%.
Classifier with type ResNet classified non-pornographic images with an accuracy of 98.9150090415913%.
Classifier with type ResNet has an overall accuracy of 98.7686213725997%.

This model is sufficient enough for real time video classification (modern hardware) at ~13.8x normal playback speed (cinema framerate), or ~333FPS. On a less efficient DNN configuration, you can see a demonstration of this here, but only at ~3.5x normal playback speed. Making this model work at 333Hz on the CPU like I did is an exercise left to the reader.

It is my hope that you'll use this model to do something good. The development of this model and things like it takes a heavy toll. I am of the opinion that this particular problem is now conquered and am making this available so neither you or anyone else will have to revisit such work again.

Todo

  • Right now this model performs very well with pornographic imagery, but still doesn't perform quite as well with plain nudity or suggestive imagery. The model can benefit from adding plain nudity, devoid of sexual actions, to the training input.

Notice

Everything except the file nsfw_squeezenet.caffemodel is a derivative of SqueezeNet 1.1 and thus is under the original copyright holder's license, the BSD 2-clause license.

nsfw_squeezenet.caffemodel is licensed under the Mozilla Public License v2.

nsfwsqueezenet's People

Contributors

technikempire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nsfwsqueezenet's Issues

Optimal rig for performance.

I have tested this model by running on AWS ec2 instances. with cpu-only caffe c5.large i got around ~700ms processing time.

Then i tried with the deep learning GPU instances with caffe-gpu, p3.2xlarge with the monstrous Tesla V100 and it did process in ~2700ms.

What is the matter here? I was expecting to see a huge improvement in performance, i suppose less that 200ms for processing the image. What am i missing?

model usage

hi! How to use your model?
Do you have a complete demo?
Thank you very much!

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.