GantMan / nsfw_model

Keras model of NSFW detector
Other
1.75k stars 273 forks source link

Autoconfigure image size based on model? #34

Open sickerin opened 5 years ago

sickerin commented 5 years ago

For the same image, I got a pretty different classification on the Inception v3 Model Keras 299x299 Image Model downloaded here vs the 93% accurate NSFW JS on the website. Is the model here kept up to date? How often is it retrained and updated?

GantMan commented 5 years ago

Was the website model lower or more accurate? I'm thinking the conversation and quant might be the culprits.

sickerin commented 5 years ago

The website on most occasions was more accurate, the wrongly classified ones (classified as more towards porn) were neutral when tested on the website. My main purpose is to detect nudity but most commonly a male being shirtless, but not completely naked, is this classified as neutral in your training set. Btw, I also tried https://github.com/bedapudi6788/NudeNet, which had a bit too many false positives.

Side question: If I want to use the Keras 224x224 Image Model, I have to make changes to keras_predict.py right? or is there a propper way to do it? I get errors when I do this

detector = NSFWDetector('./nsfw_mobilenet2.224x224.h5')

GantMan commented 5 years ago

If the website was more accurate, then I wonder if I might have failed to properly upload the latest models. I'll check on this.

Correct, if you're using python, you'll need to adjust keras_predict. Would you mind submitting a PR with your updates on the code?

A shirtless male should be neutral in this model.. but I didn't do specific training on this. If you find problems let me know, and I can possibly update the model.

sickerin commented 5 years ago

A lot of shirtless males where neutral, except maybe when the dude was really buff and muscular, or lying on the bed. I'll try training the model on them too.

Actually, for the 224x224 mobilenet, doing detector.predict("Screen Shot 2019-07-16 at 1.59.22 PM.png", image_size=(224,224)) worked, so maybe I could submit a PR for the readme on how to load it. Thanks, let me know if you decide to update the models to classify shirtless men as nsfw.

bedapudi6788 commented 5 years ago

@GantMan @sickerin When i wrote the prediction code for this repo, mobilenet pre-trained model wasn't available. I will make a PR which can auto configure the imagesize based on the model.

GantMan commented 5 years ago

you're awesome @bedapudi6788 !!!!

colindean commented 1 year ago

@bedapudi6788 Are you still interested in contributing that work?