Image Recognition using Redis Streams + RedisAI in JS - Feedback Requested


Anyone interested in taking a look at my project on Github and provide comments/feedback? I am not sure if there is a way to fix the problem. At the moment, if processing more than (currently 6) a certain number of images, after a few runs, I have to delete the stream (DEL ) and create a new one for the code to run the model and produce the right results.

As it is, the output will have the same label for mulitple images after a few runs.

Could it be that there is some delay that needs to happen between image processing? Any thought, input, suggestion is appreciated!



Hi Kim,
thanks for your message.

I took a quick glance at the code, in

I see that you are setting the model and the scripts every time you call processImage. You should only set model and scripts once upon setup (or whenever you need to update them), and then just call scriptrun and modelrun to run the model once.

Also you may want to not download the images to file but pass pixel buffers around, to avoid the I/O overhead.

Regarding your specific issue with streams, what happens if you don’t call into RedisAI but just consume the stream?



1 Like

Thank you, Luca, for response! I will take a look soon and respond.