Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
update tfjs-node to newer version

Signed-off-by: Yihong Wang <yh.wang@ibm.com>
  • Loading branch information
yhwang committed Jul 18, 2023
1 parent a969a4f commit 1d997a1
Show file tree
Hide file tree
Showing 6 changed files with 1,658 additions and 166 deletions.
32 changes: 2 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,11 @@ note that the latest `@tensorflow/tfjs-node` does not yet support the ARM64 or A
Here are the instructions for installation:

`@tensorflow/tfjs-node` on Jetson Nano and Raspberry Pi 4:
- The version must to be equal or greater then 1.5.1 (up to 1.7.3)
- Run the following command to install `tfjs-node`:
```
npm install @tensorflow/tfjs-node@1.x.y
npm install @tensorflow/tfjs-node@4.8.0
npm rebuild @tensorflow/tfjs-node --build-from-source
```
Please append the version you need. i.e @tensorflow/tfjs-node@1.5.1.
You will see an error message while downloading/installing/compiling the shared libraries
and node binding, but the JavaScript libraries are installed.
- Find the `tfjs-node` package directory on your local system. Usually it would be under `node_modules/@tensorflow/tfjs-node`
from the directory you run the `npm install` command. Switch to this directory.
directory.
```
cd node_modules/@tensorflow/tfjs-node
```
- For the Jetson Nano, you need to provide a file named `custom-binary.json` under the
`scripts` directory with the following contents:
```
{
"tf-lib": "https://s3.us.cloud-object-storage.appdomain.cloud/tfjs-cos/libtensorflow-gpu-linux-arm64-1.15.0.tar.gz"
}
```
- For the Raspberry Pi 4, you need to provide a file named `custom-binary.json` under the
`scripts` directory with the following contents:
```
{
"tf-lib": "https://s3.us.cloud-object-storage.appdomain.cloud/tfjs-cos/libtensorflow-cpu-linux-arm-1.15.0.tar.gz"
}
```
- Run the following command under the `node_module/@tensorflow/tfjs-node` directory:
```
npm install
```
This will download the pre-compiled TensorFlow shared library binary and build the node binding.

### Install this module:
Once you have installed the peer dependency, you can install this module:
Expand Down
205 changes: 204 additions & 1 deletion examples/object-detection/flows.json
Original file line number Diff line number Diff line change
@@ -1 +1,204 @@
[{"id":"e6ed8a49.34ead","type":"tab","label":"Example Flow","disabled":false,"info":""},{"id":"17135f9f.de2a4","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false},{"id":"30a983c6.f15eac","type":"camera","z":"e6ed8a49.34ead","name":"Camera","x":90,"y":120,"wires":[["b7ab82ff.b1a338","990f49cc.99ebf8"]]},{"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","parameterCount":0,"jimpFunction":"none","selectedJimpFunction":{"name":"none","fn":"none","description":"Just loads the image.","parameters":[]},"x":340,"y":60,"wires":[["b7ab82ff.b1a338","990f49cc.99ebf8"]]},{"id":"abda13e6.303bb8","type":"inject","z":"e6ed8a49.34ead","name":"Inject","topic":"","payload":"https://raw.githubusercontent.com/tensorflow/tfjs-models/master/coco-ssd/demo/image1.jpg","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":80,"wires":[["be443e0d.18f9d"]]},{"id":"b7ab82ff.b1a338","type":"image viewer","z":"e6ed8a49.34ead","name":"Original Image viewer","width":"320","data":"payload","dataType":"msg","x":680,"y":40,"wires":[[]]},{"id":"e0a513ae.0c3ff8","type":"image viewer","z":"e6ed8a49.34ead","name":"With bounding boxes","width":"320","data":"payload","dataType":"msg","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":"https://s3.sjc.us.cloud-object-storage.appdomain.cloud/tfjs-cos/cocossd/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.node.decodeImage(msg.payload, 3).expandDims(0);\n});\n\nmsg.image = msg.payload;\nmsg.payload = { image_tensor: image }\nreturn msg;","outputs":1,"noerr":0,"x":120,"y":240,"wires":[["995f6de8.b48258"]]},{"id":"995f6de8.b48258","type":"tf-model","z":"e6ed8a49.34ead","modelURL":"https://storage.googleapis.com/tfjs-models/savedmodel/ssdlite_mobilenet_v2/model.json","outputNode":"","name":"COCO SSD lite","x":120,"y":300,"wires":[["dd280bb2.d6681"]]}]
[
{
"id": "e6ed8a49.34ead",
"type": "tab",
"label": "Example Flow",
"disabled": false,
"info": ""
},
{
"id": "30a983c6.f15eac",
"type": "camera",
"z": "e6ed8a49.34ead",
"name": "Camera",
"x": 90,
"y": 120,
"wires": [
[
"b7ab82ff.b1a338",
"990f49cc.99ebf8",
"7e4a322ce12923b0"
]
]
},
{
"id": "abda13e6.303bb8",
"type": "inject",
"z": "e6ed8a49.34ead",
"name": "Inject",
"props": [
{
"p": "payload"
}
],
"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": [
[
"7e4a322ce12923b0"
]
]
},
{
"id": "b7ab82ff.b1a338",
"type": "image viewer",
"z": "e6ed8a49.34ead",
"name": "Original Image viewer",
"width": "320",
"data": "payload",
"dataType": "msg",
"active": true,
"x": 780,
"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": 1040,
"y": 560,
"wires": [
[]
]
},
{
"id": "26d5c369.1e4fc4",
"type": "fileinject",
"z": "e6ed8a49.34ead",
"name": "select an image file",
"x": 130,
"y": 40,
"wires": [
[
"7e4a322ce12923b0"
]
]
},
{
"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": 580,
"y": 540,
"wires": [
[
"e0a513ae.0c3ff8"
]
]
},
{
"id": "dd280bb2.d6681",
"type": "post-object-detection",
"z": "e6ed8a49.34ead",
"classesURL": "https://s3.sjc.us.cloud-object-storage.appdomain.cloud/tfjs-cos/cocossd/classes.json",
"iou": "0.5",
"minScore": "0.5",
"name": "post-processing",
"x": 220,
"y": 500,
"wires": [
[
"41a6b3d.e80f0cc"
]
]
},
{
"id": "990f49cc.99ebf8",
"type": "tf-function",
"z": "e6ed8a49.34ead",
"name": "pre-processing",
"func": "const image = tf.tidy(() => {\n return tf.node.decodeImage(msg.payload, 3).expandDims(0);\n});\n\nmsg.image = msg.payload;\nmsg.payload = { image_tensor: image }\nconsole.log(msg.payload);\nreturn msg;",
"outputs": 1,
"noerr": 2,
"initialize": "",
"finalize": "",
"libs": [],
"x": 120,
"y": 240,
"wires": [
[
"995f6de8.b48258"
]
]
},
{
"id": "995f6de8.b48258",
"type": "tf-model",
"z": "e6ed8a49.34ead",
"modelURL": "https://storage.googleapis.com/tfjs-models/savedmodel/ssdlite_mobilenet_v2/model.json",
"outputNode": "",
"name": "COCO SSD lite",
"x": 120,
"y": 300,
"wires": [
[
"dd280bb2.d6681"
]
]
},
{
"id": "7e4a322ce12923b0",
"type": "jimp-image",
"z": "e6ed8a49.34ead",
"name": "load 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",
"sendPropertyType": "msg",
"parameterCount": 0,
"jimpFunction": "none",
"selectedJimpFunction": {
"name": "none",
"fn": "none",
"description": "Just loads the image.",
"parameters": []
},
"x": 430,
"y": 120,
"wires": [
[
"b7ab82ff.b1a338",
"990f49cc.99ebf8"
]
]
}
]
10 changes: 5 additions & 5 deletions examples/object-detection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@tensorflow/tfjs-node": "1.4.0",
"node-red": "^1.0.3",
"@tensorflow/tfjs-node": "^4.8.0",
"node-red": "^3.0.2",
"node-red-contrib-browser-utils": "0.0.9",
"node-red-contrib-image-tools": "^0.2.5",
"node-red-contrib-post-object-detection": "^0.1.6",
"node-red-contrib-tf-function": "^0.1.0",
"node-red-contrib-tf-model": "^0.1.10"
"node-red-contrib-post-object-detection": "^0.1.7",
"node-red-contrib-tf-function": "^0.1.1",
"node-red-contrib-tf-model": "^0.1.12"
}
}
Loading

0 comments on commit 1d997a1

Please sign in to comment.