Object Detection using Node-RED TensorFlow node

The main concept behind object detection is to import a particular image or video stream and find any instances of pre-defined objects in the source media. To perform object detection, we can use a variety of deep-learning image processing and annotation tools.

One of the most well-liked technologies for image processing and annotation is TensorFlow. It's a free, open-source software library that Google created for artificial intelligence, image processing, and machine learning.

We'll cover how to use the TensorFlow Node-RED for object identification today. Node-RED is a flow-based programming environment that is simple to use and requires little code.

To learn how to install Node-RED in windows, please go through the article titled:

How to Install Node-RED on Windows? alert-info

Installing Node-RED TensorFlow node:

We will need to install the Node-RED TensorFlow library using the following npm command using the command prompt or terminal.

npm install node-red-contrib-tensorflow

Or, we can install the latest stable library from the manage palette option in Node-RED. For this, go to the MENU -  MANAGE PALETTE -  INSTALL option, search for node-red-contrib-tensorflow and click the install button. 

Object Detection using Node-RED TensorFlow node
Installing Node-RED TensorFlow Library Node

TensorFlow Models:

These four pre-trained model library nodes comes with the TensorFlow js node. 

  • Object Detection (cocossd) -- The node to identify objects in an image
  • MediaPipe Handpose -- The node to detect fingers in a hand
  • MobileNet -- The node to classify images with MobileNet
  • PoseNet Model -- The node to estimate human pose

Our main objective is to explore the Object Detection node. 

Let's plot the flow and start image processing using Node-RED and TensorFlow.

Object Detection using Node-RED TensorFlow node
Object Detection using Node-RED TensorFlow node

We are going to need one more flow to import the test pictures. The node is called the file inject node. To install, run the following command or search for the node-red-contrib-browser-utils node from the manage palette option. 

npm install node-red-contrib-browser-utils

The example flow:

[{"id":"8cf612d2ba67f3cf","type":"tab","label":"Object Detection","disabled":false,"info":"","env":[]},{"id":"0b399f0271bc904b","type":"fileinject","z":"8cf612d2ba67f3cf","name":"","x":900,"y":60,"wires":[["cdb3d9705a6227cc"]]},{"id":"cdb3d9705a6227cc","type":"image","z":"8cf612d2ba67f3cf","name":"","width":160,"data":"payload","dataType":"msg","thumbnail":false,"active":true,"pass":true,"outputs":1,"x":1080,"y":60,"wires":[["8c9224834ce3715c"]]},{"id":"cbfe03366e8c2f6a","type":"debug","z":"8cf612d2ba67f3cf","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1500,"y":60,"wires":[]},{"id":"8c9224834ce3715c","type":"cocossd","z":"8cf612d2ba67f3cf","name":"","x":1300,"y":60,"wires":[["cbfe03366e8c2f6a"]]}]code-box

To import the flow, go to the MENU -  IMPORT - option and past the JSON code.alert-info

Image processing output:

By importing the subject image by using the browser utils node to the flow, the cocossd Node-RED TensorFlow node will process the image and output the result in msg.payload. Using the debug node, we can print the output in the debug message area.

Object Detection using Node-RED TensorFlow node output result
Node-RED TensorFlow node output result

Video instructions to setup Node-RED for TensorFlow Object Detection

0/Post a Comment/Comments