Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Higher accuracy model #276

Closed
scratcher28 opened this issue Mar 26, 2020 · 11 comments
Closed

Higher accuracy model #276

scratcher28 opened this issue Mar 26, 2020 · 11 comments
Labels
False Positives Issues with false positives - commonly reproducable

Comments

@scratcher28
Copy link

Does anyone have success in training the higher accuracy model(s)?

@GantMan
Copy link
Member

GantMan commented Mar 27, 2020

The 93% accuracy is held back by the strange line between sexy/porn.

I dare say if you combined those two, the accuracy would go up significantly.

@scratcher28
Copy link
Author

I have 250GB of different images and I am experiencing a lot of false positives:
a) text banners rarely flagged as drawings;
b) decent / neutral photos flagged as porn.

I had to code some tricky logical prediction normalizer to decrease these cases, but it doesn't help that much. It seems I need to train my own model ))

@GantMan
Copy link
Member

GantMan commented Mar 27, 2020

Just to verify, can you provide some of those false positives here? Along with whatever model you're using? We have several published versions now.

@GantMan GantMan added the False Positives Issues with false positives - commonly reproducable label Mar 27, 2020
@shib41nu
Copy link

shib41nu commented Apr 2, 2020

I have the same problem. I have a lot of pictures with only the upper body, but because of the hot weather, many people wear very few clothes or no clothes. These are not elegant, but this type of photos are recognized as neutral So I want to retrain the model. Any other suggestions? Thank you!

@GantMan
Copy link
Member

GantMan commented Apr 30, 2020

@wunamesst - please take a look at the new 6.1 MB model and let me know how it performs

https://nsfwjs.com/

@qwertyforce
Copy link
Contributor

qwertyforce commented Apr 30, 2020

@GantMan
Copy link
Member

GantMan commented Apr 30, 2020

Hey @qwertyforce - so here's the deal and maybe you can help me fix our example? It's not complicated, but this will come across as wordy.

That new model is a graph model. More specifically it's a DAG.

DAGs are fast/portable, but cannot be used for inference. The 2.6MB model is a "Layers" model. Which is slightly slower on loading/perf but can be disected for inference/transfer learning.

To tell TensorFlow.js which model it's working with, you use loadLayersModel or loadGraphModel.

Originally NSFWJS only did Layers models, until I did this update: 1368d6d

Can you please point your code at Master on GitHub, and try loading your model with the options set to { type: "graph" } and then it should work.

If it does!!! I'll take in any PR you might have to help document this AND release a new version so you don't have to point at GitHub.

Sorry, but the code was only updated last night! Hah.

@qwertyforce
Copy link
Contributor

qwertyforce commented Apr 30, 2020

@GantMan
It's not working :(
file://./model/ = https://github.com/infinitered/nsfwjs/tree/master/example/nsfw_demo/public/model
file://./model_new/ = https://github.com/infinitered/nsfwjs/tree/master/example/nsfw_demo/public/quant_mid

file://./model/ - working
file://./model_new/ - not working

Here is my example

const axios = require('axios');
const tf=require('@tensorflow/tfjs-node')
const nsfw = require("nsfwjs");
async function fn() {
  let pic= await axios.get(`https://i.imgur.com/bFDWhkK.jpg`,{responseType: 'arraybuffer' })
  // const model = await nsfw.load('file://./model/',{size: 299});
  const model = await nsfw.load('file://./model_new/',{ type: "graph" });
  const image = tf.node.decodeImage(pic.data);
  const predictions = await  model.classify(image);
  console.log(predictions)
}
fn()

`

@GantMan
Copy link
Member

GantMan commented Apr 30, 2020

And you're 100% sure you're pointed at Master for NSFWJS?

What version of tfjs-node do you have? The latest?

@qwertyforce
Copy link
Contributor

@GantMan I am so sorry... I have just built it from source and everything is working!

@GantMan
Copy link
Member

GantMan commented May 1, 2020

awesome! Good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positives Issues with false positives - commonly reproducable
Projects
None yet
Development

No branches or pull requests

4 participants