here is my flow
[
{
"id": "e6ed8a49.34ead",
"type": "tab",
"label": "Traffic sign",
"disabled": false,
"info": ""
},
{
"id": "30a983c6.f15eac",
"type": "camera",
"z": "e6ed8a49.34ead",
"name": "Camera",
"x": 90,
"y": 120,
"wires": [
[
"b7ab82ff.b1a338"
]
]
},
{
"id": "be443e0d.18f9d",
"type": "jimp-image",
"z": "e6ed8a49.34ead",
"name": "load the image",
"data": "payload",
"dataType": "msg",
"ret": "buf",
"parameter1": "",
"parameter1Type": "msg",
"parameter2": "",
"parameter2Type": "msg",
"parameter3": "",
"parameter3Type": "msg",
"parameter4": "",
"parameter4Type": "msg",
"parameter5": "",
"parameter5Type": "msg",
"parameter6": "",
"parameter6Type": "msg",
"parameter7": "",
"parameter7Type": "msg",
"parameter8": "",
"parameter8Type": "msg",
"sendProperty": "payload",
"parameterCount": 0,
"jimpFunction": "none",
"selectedJimpFunction": {
"name": "none",
"fn": "none",
"description": "Just loads the image.",
"parameters": []
},
"x": 340,
"y": 60,
"wires": [
[
"b7ab82ff.b1a338",
"9d9a08561d941b12",
"990f49cc.99ebf8"
]
]
},
{
"id": "abda13e6.303bb8",
"type": "inject",
"z": "e6ed8a49.34ead",
"name": "Inject",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "https://raw.githubusercontent.com/tensorflow/tfjs-models/master/coco-ssd/demo/image1.jpg",
"payloadType": "str",
"x": 90,
"y": 80,
"wires": [
[
"be443e0d.18f9d"
]
]
},
{
"id": "b7ab82ff.b1a338",
"type": "image viewer",
"z": "e6ed8a49.34ead",
"name": "Original Image viewer",
"width": "100",
"data": "payload",
"dataType": "msg",
"active": true,
"x": 680,
"y": 40,
"wires": [
[]
]
},
{
"id": "e0a513ae.0c3ff8",
"type": "image viewer",
"z": "e6ed8a49.34ead",
"name": "With bounding boxes",
"width": "320",
"data": "payload",
"dataType": "msg",
"active": true,
"x": 680,
"y": 340,
"wires": [
[]
]
},
{
"id": "26d5c369.1e4fc4",
"type": "fileinject",
"z": "e6ed8a49.34ead",
"name": "select an image file",
"x": 130,
"y": 40,
"wires": [
[
"be443e0d.18f9d"
]
]
},
{
"id": "41a6b3d.e80f0cc",
"type": "bbox-image",
"z": "e6ed8a49.34ead",
"strokeWidth": "4",
"fontSize": "16",
"objectsProp": "payload",
"objectsPropType": "msg",
"imageProp": "image",
"imagePropType": "msg",
"name": "bounding-box",
"x": 340,
"y": 360,
"wires": [
[
"e0a513ae.0c3ff8"
]
]
},
{
"id": "dd280bb2.d6681",
"type": "post-object-detection",
"z": "e6ed8a49.34ead",
"classesURL": "file:///home/pi/mymodel/classes.json",
"iou": "0.5",
"minScore": "0.5",
"name": "post-processing",
"x": 120,
"y": 360,
"wires": [
[
"41a6b3d.e80f0cc"
]
]
},
{
"id": "990f49cc.99ebf8",
"type": "tf-function",
"z": "e6ed8a49.34ead",
"name": "pre-processing",
"func": "const image = tf.tidy(() => {\n return tf.image.resizeBilinear(tf.node.decodeImage(msg.payload, 3), [30, 30]).expandDims(0)\n .toFloat().div(tf.scalar(127)).sub(tf.scalar(1));\n});\nmsg.image = msg.payload;\nmsg.payload = [image]\n\nreturn msg;",
"outputs": 1,
"noerr": 5,
"x": 140,
"y": 200,
"wires": [
[
"d7528f2297e13795",
"995f6de8.b48258"
]
]
},
{
"id": "995f6de8.b48258",
"type": "tf-model",
"z": "e6ed8a49.34ead",
"modelURL": "file:///home/pi/mymodel/model.json",
"outputNode": "",
"name": "Traffic sign recognition",
"x": 140,
"y": 300,
"wires": [
[
"dd280bb2.d6681",
"d6444996cec934a9"
]
]
},
{
"id": "d6444996cec934a9",
"type": "debug",
"z": "e6ed8a49.34ead",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 380,
"y": 280,
"wires": []
},
{
"id": "d7528f2297e13795",
"type": "debug",
"z": "e6ed8a49.34ead",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 380,
"y": 200,
"wires": []
},
{
"id": "9d9a08561d941b12",
"type": "debug",
"z": "e6ed8a49.34ead",
"name": "debug 6",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 680,
"y": 220,
"wires": []
},
{
"id": "ab7b41fa0c5780ce",
"type": "tf-function",
"z": "e6ed8a49.34ead",
"name": "pre-processing",
"func": "const image = tf.tidy(() => {\n //return tf.node.decodePng(msg.payload, 0).expandDims(0);\n return tf.node.decodeImage(msg.payload, 0).expandDims(0);\n});\n//msg.payload = tf.reshape(image, [1, 30, 30, 3])\nmsg.image = msg.payload;\n\n//msg.image = tf.reshape(image, [1,30,30,3]);\nmsg.payload = image;\nmsg.payload = tf.slice(msg.payload, [0, 0, 0, 1],[1,30, 30, 3])\n//msg.payload = { image_tensor: image };\n//msg.payload = tf.tensor(msg.payload).reshape([1, 512, 512, 2]);\nreturn msg; ",
"outputs": 1,
"noerr": 3,
"x": 360,
"y": 600,
"wires": [
[]
]
},
{
"id": "b8bf37ab85451ec9",
"type": "tf-function",
"z": "e6ed8a49.34ead",
"name": "",
"func": "const image = tf.tidy(() => {\n return tf.node.decodeImage(msg.payload, 3).expandDims(0)\n .div(tf.scalar(127)).sub(tf.scalar(1));\n});\n//msg.payload.dataSync()[0]\nmsg.image = msg.payload;\nmsg.payload = [image]\nreturn msg;",
"outputs": 1,
"noerr": 4,
"x": 860,
"y": 640,
"wires": [
[]
]
}
]