kazuhitoyokoi / node-red-contrib-tensorflow

Apache License 2.0
22 stars 7 forks source link

When trying to use cocossd node you get the following error #3

Closed kazuhitoyokoi closed 4 years ago

kazuhitoyokoi commented 4 years ago

When trying to use cocossd node you get the following error

TypeError: response.arrayBuffer is not a function

When you deploy after adding the node to the flow you get the following

image

7 Jul 09:19:38 - [error] [cocossd:4652ace5.1a4934] TypeError: response.arrayBuffer is not a function 7 Jul 09:19:38 - [error] [cocossd:4652ace5.1a4934] TypeError: response.arrayBuffer is not a function (node:16) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'detect' of undefined at /data/node_modules/node-red-contrib-tensorflow/tensorflow.js:49:34 at process._tickCallback (internal/process/next_tick.js:68:7) (node:16) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

HTH

Originally posted by @ozmule in https://github.com/kazuhitoyokoi/node-red-contrib-tensorflow/issues/2#issuecomment-654509799

Aterfax commented 4 years ago

Also have this on my instance.

Appears to fail to load all model types -

[error] [posenet:3a103bd8.2c7214] TypeError: response.arrayBuffer is not a function

Aterfax commented 4 years ago

This might be related to multiple node modules trying their own method to load tensorflow - if you have more than one module trying its own method to load it might be conflicting.

This module appears to load its own tensorflow where other modules such as node-red-contrib-post-object-detection are loading @tensorflow/tfjs-node

I think this might have been why mine was erroring out - though I have not tested this as I am trying to get the GPU accelerated version of @tensorflow/tfjs-node .

kazuhitoyokoi commented 4 years ago

@Aterfax Thank you for your information. Do I need to just add information about the conflict to the README.md document?

Aterfax commented 4 years ago

I think that would be a great idea - just a reminder for people in case they are testing out different modules that there can be conflicts in terms of the backend method of loading tensorflow between different modules.

This is mentioned in the node-red-contrib-post-object-detection module :

Putting TensorFlow.js as the dependency of a custom Node-RED node may cause the situation where multiple custom nodes each install their own tfjs-node module as a dependency. This causes an attempt at loading multiple TensorFlow shared libraries in the same process, which subsequently causes the process to abort with a protobuf assertion error.

This said, it might be an idea that these modules for nodered load tensorflow in the same way with the user manually installing their chosen @tensorflow/tfjs-node or @tensorflow/tfjs-node-gpu that way they are aware of the choice in hardware acceleration but also to avoid this issue.

brianmangan commented 2 years ago

To add to this conversation: I was getting the same issues, after upgrading the node in place. Here is how I fixed my issue (YMMV):

  1. remove any nodes from your pallet that use tensorflow.js (see above for known incompatibilities)
  2. remove any of these nodes from this modules
  3. Remove node-red-contrib-tensorflow from your pallet
  4. restart node-red instance (full restart)
  5. add node-red-contrib-tensorflow back to the pallet and drop in the nodes that were deleted.
lmktommy commented 10 months ago

I try to use but it shows the error as below. Please help. Thank you.

Screenshot 2023-10-21 at 11 43 51 PM