nsfw_model icon indicating copy to clipboard operation
nsfw_model copied to clipboard

different model results beteewn keras/tensorflow models and tensorflowjs model

Open sodagreat opened this issue 6 years ago • 3 comments

I have compared the results between keras/pb and tensorflowjs , the js model is always good, but the tensorflow pb model and keras h5 model produce much worse result. Every model I have all tried as i can. Is there something wrong with the model?

sodagreat avatar Jun 06 '19 12:06 sodagreat

Odd! The JS model is generated FROM the Keras model. Would you like to share your Keras comparison code?

GantMan avatar Jun 06 '19 13:06 GantMan

Odd! The JS model is generated FROM the Keras model. Would you like to share your Keras comparison code?

I just use the predict interface of nsfw_detecor as the example. Found two factors that affect the results: image resize params and model quantization. I have checked the nsfwjs source code, which use bilinear interpolation. And i also compared results between normal model and quantized model, quantized model gives more reasonable predictions.

sodagreat avatar Jun 10 '19 07:06 sodagreat

This is news to me! I wonder why quantization improves accuracy.

GantMan avatar Jun 17 '19 12:06 GantMan