nsfw_model icon indicating copy to clipboard operation
nsfw_model copied to clipboard

Autoconfigure image size based on model?

Open sickerin opened this issue 5 years ago • 7 comments

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?

sickerin avatar Jul 16 '19 04:07 sickerin

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

GantMan avatar Jul 16 '19 05:07 GantMan

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')

sickerin avatar Jul 16 '19 06:07 sickerin

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.

GantMan avatar Jul 17 '19 05:07 GantMan

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.

sickerin avatar Jul 18 '19 07:07 sickerin

@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.

bedapudi6788 avatar Jul 31 '19 09:07 bedapudi6788

you're awesome @bedapudi6788 !!!!

GantMan avatar Aug 01 '19 03:08 GantMan

@bedapudi6788 Are you still interested in contributing that work?

colindean avatar Feb 24 '23 04:02 colindean