nsfwjs icon indicating copy to clipboard operation
nsfwjs copied to clipboard

Questions + Error 500: Input to reshape is a tensor with 451584 values, but the requested shape has 150528

Open Blabla5943 opened this issue 3 years ago • 4 comments

Hello,

I use NSFWJS with this docker projet: https://github.com/andresribeiro/nsfwjs-docker (by @andresribeiro)

But, when I use GIF image, I have this error: Error 500: Input to reshape is a tensor with 451584 values, but the requested shape has 150528

Why? How can I fix this?

Questions: Currently, to test an image, I test it without worrying about its size? Does NSFWJS take care of resizing it automatically? Or do I have to do a resize myself? With ImageMagick before?

Thanks! :)

Blabla5943 avatar Feb 17 '22 09:02 Blabla5943

NSFWJS usually resizes the image for you. Can you supply the gif you're having trouble with?

Does the gif work on NSFWJS.com?

GantMan avatar Feb 17 '22 22:02 GantMan

NSFWJS usually resizes the image for you. Can you supply the gif you're having trouble with?

Does the gif work on NSFWJS.com?

Great! Yes, I have attached 2 GIF images with this error.

1143869364 Source: https://www.zupimages.net/up/1143869364.gif

880196740 Source: https://www.zupimages.net/up/880196740.gif

When I try the files on NSFWJS.com, I don't have any error. Why there is error on docker projet?

Thanks!

Blabla5943 avatar Feb 17 '22 22:02 Blabla5943

are you using classifyGif command? or classify?

GantMan avatar Feb 17 '22 22:02 GantMan

are you using classifyGif command? or classify?

I use this projet: https://github.com/andresribeiro/nsfwjs-docker

I called the API with this CURL command line: curl -F "content=@/images/a.gif" "http://localhost:3333/single/multipart-form"

So I don't know which function is actually called. But, there is the code here: https://github.com/andresribeiro/nsfwjs-docker/blob/main/src/getPrediction.ts I think it's this: const prediction = await model.classify(tfImage)

Blabla5943 avatar Feb 17 '22 23:02 Blabla5943