infinitered / nsfwjs

NSFW detection on the client-side via TensorFlow.js
https://nsfwjs.com/
MIT License
7.94k stars 529 forks source link

Angular 14 ng production build gives "the tensor should have 409600 values but has 5803" #875

Open bbright-dinesh opened 1 month ago

bbright-dinesh commented 1 month ago

When I try to run the angular 14 in debug build, I am able to scan the image and getting the proper image properties.

But, When I run in production build, We are getting the above error while parsing image. Is there any different between prod/debug build ???

Kindly let us know.

We are using mobilnet_v2 for scanning the images.

Here is the full error message.

Based on the provided shape, [1,1,320,1280], the tensor should have 409600 values but has 5803

bbright-dinesh commented 1 month ago

Any help here please

GantMan commented 1 month ago

That's an interesting error. I'm not familiar with any bug that should cause that :/

bbright-dinesh commented 1 month ago

Thank you @GantMan for responding.

There are no errors at all, when the build is in Debug mode, but it's the error only we are facing in the release mode. It would be great someone to shed some light into this. Or let me know if any pointers to debug this case.

Thank you.

GantMan commented 1 month ago

You might want to check into the TensorFlow flags

https://www.tensorflow.org/js/guide/platform_environment#flags & https://github.com/infinitered/nsfwjs/tree/5ce2a0863db5e20c19cbe901b3454c8a7c16918a?tab=readme-ov-file#production

I don't know what could be changing because these are manual flags, though.

bbright-dinesh commented 1 month ago

Thank you @GantMan for the directions.

Let me look into this and see why the release mode behaving a little different.