[ANNOUNCE] node-red-contrib-plate-recognizer

Hi @lizzardguki,

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:

I had the same idea as you, when I was developing this node. But not sure if a 'simplified output' would be that much easier to parse ...

But perhaps we can add an example flow to explain how you can easily get the license plates from the output?

P.S. I assume that Jsonata is the best way to do this via a change node? Or does anybody know a better way? Example expressions are always welcome!!

so what is it if there is only one plate ? Hopefully an array of size one.

Yes indeed. And if no plates, then an array of size 0.

1 Like

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:

image

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 :rofl:

touché !
though as we always say "the most interesting part of the data should be in the payload" :slight_smile: 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:

image

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!!

Bart

5 Likes

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 :slight_smile:
image

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" !?


As soon as I deactivate these 2 nodes, I find a normal ram consumption between 60-80% max
if someone find something , i'm interested :woozy_face:

1 Like

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:

  1. Coco-ssd node counts the number of cars.
  2. 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 ...
  3. Then send only those images to the platerecognizer service.
  4. Lookup the license plate in a list of known license plates
  5. 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.

Bart

That's sound good !

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.

This is the flux :

At the time when I speak to you I emptied the flow.set2 buffers and the RAM continues to rise:

and suddenly come back down !? image

I have many lines: --max_old_space_size=256


what is it ? Is this showing a fault?

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 :face_with_raised_eyebrow:

yes , this one :

Yes I store the camera image in a persistent variable: flow.set('pictureRawBuffer',pictureRawBuffer);

  • in raw format for plate detection
  • in a format after B64 to display the image with its detected objects in a frame in the dashboard.

I thought that these 2 persistent variables could occupy a lot of RAM, but apparently, by erasing them the curve progresses nevertheless.

You're right, I would have said the same :grin: I will separate the 2 and see who is at fault.

Have you encountered the same memory leak problem by combining the 2?
Do you know what it means: --max_old_space_size=256 ?

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?

Thanks!

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)

Please do !!!! All Node-RED image processing help is welcome! :+1: :+1: :+1:

1 Like

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.

Yes tensorflow is a bit of a beast.
You can change the max-old-space setting in the nodered.service file to give you more headroom if you like.

2 Likes