Node red+ raspberry pi_push_button+image classification


flows.json (3.0 KB)
So once I press the button, it will capture image and classify the image based on the model. I have used the model that nodered already provides. But I think there is sth wrong from usbcamera portion to mobilenet. That's why I cannot get the image classification result. But I don't know how. I am not sure if I am asking the basic question. Meanwhile I will try to get the result as much as I can but much appreciate for help. Thank you.

Hi @MK1992 ,

As you can see in the first debug message, the msg.payload of the mobilenet output message contains an array with the names of the detected object.
But you also send that array of names to the image preview node, so it is very normal that your image preview node cannot show it.
You should wire your image preview node to the output of the usbcamera node I assume ...
Bart

Hi although I have made changes, the problem still persists.
flows (1).json (2.0 KB)

It would be better (and more traditional) to post your flow between the triple backticks (use the </> icon in the editor) so we don't have to deal with download links.

In my testing, the classifications came from a debug node set to msg.classes, not msg.payload.

[{"id":"1da9c43d.77184c","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"b1428df3.67c61","type":"usbcamera","z":"1da9c43d.77184c","filemode":"1","filename":"image01.jpg","filedefpath":"1","filepath":"","fileformat":"jpeg","resolution":"5","name":"","x":330,"y":100,"wires":[["ae8b99d3.4c8418","eef158a4.21dce8"]]},{"id":"bbd793a1.7a082","type":"rpi-gpio in","z":"1da9c43d.77184c","name":"Button","pin":"11","intype":"down","debounce":"25","read":false,"x":110,"y":240,"wires":[["3bec5dde.56dd12"]]},{"id":"3bec5dde.56dd12","type":"function","z":"1da9c43d.77184c","name":"","func":"if (msg.payload == 1){\nvar now = new Date().toLocaleString(\"en-US\");\nnow = now.replace(\",\",\"\");  // clear out comma\nnow = now.replace(/\\//g,\"-\");  // replace all slashes\nnow = now.replace(/ /g,\"_\");  // replace all spaces\nmsg.filename = \"image_\" + now;\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":220,"y":300,"wires":[["b1428df3.67c61"]]},{"id":"eef158a4.21dce8","type":"mobilenet","z":"1da9c43d.77184c","name":"","x":520,"y":100,"wires":[["1c235fd7.997f3"]]},{"id":"1c235fd7.997f3","type":"debug","z":"1da9c43d.77184c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":730,"y":140,"wires":[]},{"id":"4524ba7d.a66544","type":"inject","z":"1da9c43d.77184c","name":"Take Photo","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Take Photo","payloadType":"str","x":120,"y":160,"wires":[["b1428df3.67c61"]]},{"id":"ae8b99d3.4c8418","type":"image","z":"1da9c43d.77184c","name":"","width":160,"data":"payload","dataType":"msg","thumbnail":false,"active":false,"pass":false,"outputs":0,"x":580,"y":220,"wires":[]}]

I have got the classification with mobilenet which is default model when i install tensorflow in nodered, and I want to do deep learning with custom dataset with the model I have trained in nodered. is that possible to do that? Thank you.

Just now I saw that we can convert tensoflow to tensorflow.js model for custom image classification but the problem is how we gonna define this as a node in nodered?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.