Let's give an example, so everybody knows what we are talking about.
When the input is an image containing two license plates, then the output will be an array of length two:
Would it be better perhaps if a checkbox is added "Send message for each plate". When this is activated and N plates are being detected, then N messages will be send (each containing a single plate instead of an array). Such messages might be easier to handle, compared to an array.
P.S. not sure what to do when no plates are detected: send no message or send a message with an undefined plate?
If I send a picture I'd expect something back... an array from 0 to n - one per plate - would make sense to me. Shame it's not being returned as the payload - as then the split node would handle no problem.
You can select both the input and output fields in the config screen:
But of course normally the input image is delivered in the input message as payload, and I want to keep the image in the output message (as payload). For example to email both the image and the recognition result, when the plate is unknown.
Shame then that the split node only handles msg.payload as input
touché !
though as we always say "the most interesting part of the data should be in the payload" If you want to email the image you're going to have to move it to msg.attachments anyway aren't you ?
Version 1.0.3 has been published on NPM, which contains the new option:
The alternative solution (based on the Split-node) has also been demonstrated on the readme page, so people can decide which way they want to go ...
P.S. The (very friendly) people of platerecognizer.com have asked me to write a guest blog, so here it is. A bit of advertisement for Node-RED cannot harm...
By the way, if somebody has a nice use case for license plate recognition please let me know!!
Hi Bart,
This is my project : the idea to combine the tfjs-coco-ssd of @dceejay and your plate-recognizer. The portal surveillance camera detects movement
=> sends an image in FTP on node-red
=> the node tfjs checks if it is a car (to avoid false alarms)
=> your node checks the plate, and say with audio node "Christian vehicle autorized"
=> compare the saved plates and opens the portal
I can detect if the postman has passed: I post an envelope on the Dashboard, intruders etc ... each image is stored for later reading.
Everything works until the gate opens: I'm in the process of creating a secure wireless network.
By cons I have an impressive RAM consumption even after detection! I heard about "memory leakage" !?
That is the same idea as I had ...
Because it makes sense to use coco-ssd to detect a car (since that is part of the model) in your camera footage, and - only when you detect a car - send the images to the plate recognizer service. Then you avoid lots of useless recognitions without a car.
In fact I wanted to do it like this:
Coco-ssd node counts the number of cars.
Only proceed if the number of cars has changed: if increased then a car has arrived, if decreased then a car has departed. Of course only proceed when the number of cars is > 0 ...
Then send only those images to the platerecognizer service.
Lookup the license plate in a list of known license plates
Trigger different actions in the flow, depending whether the license plate is know or not
And when you only run the coco-ssd or only the platerecognizer node. Is it high then afterwards also? I have no idea how much RAM the coco-ssd uses to load the model. Please let us know which of both nodes causes the issue. But indeed it is not normal that the memory stays high, unless the coco-ssd uses a lot of memory to store the model.
P.S. Be aware that the output messages of the plate recognizer node also contains the input image. So if you store those messages somewhere (e.g. via a Delay, RBE, ... node), then some of those messages will be kept in memory. That could also explain why memory usage keeps being high.
Don't think there is any relation here to memory leakage.
I deactivated one or the other and each time I see the RAM going up without reason, while I do not make detection. If I leave like this the RPI is planted, I must turn off and on again.
I can restart Node-Red just before and "purge the ram" but if I let it saturate after feww hours.
You mean that you disable the nodes via the "enable" button on their config screen. If so, I don't think that is sufficient? You should create a simple test flow with only coco-ssd and afterwards one with only license plate node. Otherwise we have no idea which one is the root cause..
I have no idea at all what that is about. Are that flow variables that you have defined yourself? You really should start with a simple flow to determine the root cause, because the flow in your screenshot might be understandle for you but for me it is just a huge pile of nodes
I'm not sure whether disabling a node doesn't call it's startup code... Because perhaps the coco-ssd model is still loaded if you disable it. Don't know it at the moment. Will need to test it later ...
The output message of the license plate node contains both the input image AND the detected objects. But seems like the coco-ssd node doesn't pass the input image. Would perhaps be useful to have that as a feature, so you don't need to store it on memory ... @dceejay: is it ok for you if I create a pull request to pass the input image (always) to the output message? Similar to my screenshot above? Thanks!
I didn't have a look at the memory at that time. Did only a quick test without any memory performance.
Yes and hello my friends! In addition, for some distant camera views, it could be interesting to cut out the framed part of the image and zoom in. To be able to better detect the plate number (like in the image above with the Fiat entering the drive way). If you install opencv4nodejs you can do all that in javascript in post processing before you send it to platerecognizer service
Hey Walter,
That could indeed be a good enhancement! Although I'm not sure if the recognition will be better quality if you digitally (instead of optically) zoom in on a picture? No idea at all ...
P.S. I don't want to go too much off-topic in this plate recognition discussion, but not sure what you mean by "If you install opencv4nodejs you can do all that in javascript"? Because opencv4nodejs uses the native (C) bindings of opencv, and not opencv.js (to have full javascript). But probably I have misunderstood you. Can you please explain in a separate discussion how it works and how we can use it?
Yes, that's fine, we can do if needed, (it was just what you touched, having access to opencv's image manipulation functions, maybe it's not needed if other options are available)
I deleted the plate-recognizer node and the memory leaks come back with tfjs-coco-ssd @dceejay :
Do you get this message when you start node-red (in the node-red-log) or after few times ? 2020-03-25 23: 27: 29.218208: W tensorflow / core / framework / allocator.cc: 107] Allocation of 8640000 exceeds 10% of system memory.