tensorflow / sig-tfjs Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
This issue was automatically created by Allstar.
Security Policy Violation
Project is out of compliance with Binary Artifacts policy: binaries present in source code
Rule Description
Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.
Remediation Steps
To remediate, remove the generated executable artifacts from the repository.
First 10 Artifacts Found
Additional Information
This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.
Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar
This issue will auto resolve when the policy is in compliance.
Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.
Awesome project! Thanks for your efforts! :)
Thank you for making such a wonderful project.
I've trying to use tensorflow.js with webnn-native on my PC from building tensorflowlite and webnn-native from source.
I was able to get libwebnn_native.so and libngraph_c_api.so from webnn-native and libtensorflowlite_c.so from tensorflowlite according to the document instructions.
But I couldn't find any documents how to generate libexternal_delegate_obj.so which is in tfjs-tflite-node/cc_deps/linux_amd64). And webnn_external_delegate_obj.so as well.
May I ask you how to make those parts?
Currently, the backend dropdown menu is the same for all models regardless of available backends. There is no error shown. As a result, you can click "Run" before any error is surfaced.
For example, the Text Toxicity model does not support WASM. Once the debugger is running, a pop-up appears with the following error:
Failed to run model: Kernel 'SparseToDense' not registered for backend 'wasm'
Only display available backends in the dropdown menu.
When clicking on nodes in 2D format, sometimes nodes cannot be selected. Sometimes clicking on other nodes resolves the issue. This happens for any graph of any model, so it is not unique to any model or format.
See video for example. I had the developer console open to show that no errors are surfaced.
When using the code editor for generating tensors or post-processing, the buttons are labeled Execute
and Done
. It can be easy to exit the code editor before running the code, and the developer may not realize that it hasn't run. I suggest one of the three following solutions:
Done
button and instead put an X in the top corner of the pop-up.Done
to Close
. This might not fully fix the issue, but it could help.Done
to confirm that the user meant to close. This pop-up could include a Run
button so users can run the code without having to return to the editor.Hello !
Do you know how can I access the SignatureDef to be able to reuse the output to refeed the input like in the MoviNet architecture; I need to know the real name of the output I think to map them to the inputs.
Here a related issue: https://stackoverflow.com/questions/68180174/outputs-of-tensorflow-lite-model-look-like-statefulpartitionedcalln-what-is-no
Is there any access to api like interpreter.get_signature_runner()
?
import { resolve } from "path";
import "@tensorflow/tfjs-backend-cpu";
import * as tf from "@tensorflow/tfjs-core";
import * as tflite from "tfjs-tflite-node";
const model = resolve(
"static/lite-model_movinet_a1_stream_kinetics-600_classification_tflite_float16_2.tflite"
);
const find = (d, obj) => Object.entries(obj).find(([k]) => d.includes(k))[1];
const tfliteModel = await tflite.loadTFLiteModel(model);
const getName = (name) => name.slice("serving_default_".length, -":0".length);
const inputs = tfliteModel.modelRunner
.getInputs()
.map((input) => ({ input }))
.map(({ input, input: { name, shape, dataType: d, quantization } }) => ({
input,
shape,
quantization,
dtype: find(d, { int: "int32", float: "float32", bool: "bool" }),
name: getName(name),
}));
console.log(inputs.map(({ name }) => name));
const quantizedScale = (name, state) => {
const { dtype, quantization: [scale, zeroPoint] = [0, 0] } = inputs.find(
({ name: v }) => v === name
);
return name.includes("frame_count") || dtype === "float32" || scale === 0
? state
: tf.cast(tf.sum(tf.div(state, scale), zeroPoint), dtype);
};
const initStates = inputs.map(({ name, shape, dtype }) =>
quantizedScale(name, tf.zeros(shape, dtype))
);
const video = tf.ones([1, 5, 172, 172, 3]);
const clips = tf.split(video, video.shape[1], 1);
let states = initStates;
for (const clip of clips) {
const frame = quantizedScale("image", clip);
inputs.forEach(({ name, input }, i) =>
name === "image" ? input.data().set(frame) : input.data().set(states[i])
);
tfliteModel.modelRunner.infer();
states = tfliteModel.modelRunner.getOutputs();
}
Hello,
I tried this example and run it on raspberry pi with coral. It work well. Thank you…
I have question, little bit out contexts.
however, when I tried to implement the coral delegates for @tensorflow/qna is difficult. Since the mobileBert pre-trained model is auto load from the qna package.
it is still possible using Coral delegates for qna? Or Coral only work for object detection model like in this tutorial? Thank you..
Once you click Run
, any errors that occur render the debugger frozen. The only way to resolve the issue is to refresh the website.
When an error appears, the Dismiss
button returns the user to the configuration screen.
For future folks who'll need to use this library on Amazon Linux Lambda, here is a Dockerfile to build libtensorflowlite_c.so
needed to start tfjs-tflite-node
:
FROM amazon/aws-lambda-nodejs
RUN yum install tar git wget openssl-devel python-pip -y \
&& yum groupinstall "Development Tools" -y \
&& pip install cmake --upgrade
RUN git clone --depth 1 https://github.com/tensorflow/tensorflow.git tensorflow_src
RUN mkdir tflite_build
WORKDIR tflite_build
RUN sed -i -e 's/common.c/common.cc/g' ../tensorflow_src/tensorflow/lite/c/CMakeLists.txt
RUN cmake ../tensorflow_src/tensorflow/lite/c
RUN cmake --build . -j 2
# docker cp my-container:/var/task/tflite_build/libtensorflowlite_c.so ./node_modules/tfjs-tflite-node/cc_deps/linux_amd64/libtensorflowlite_c.so
# OR
RUN yum install python3 -y
COPY package.json ./
RUN npm install
RUN cp /var/task/tflite_build/libtensorflowlite_c.so /var/task/tflite_build/node_modules/tfjs-tflite-node/cc_deps/linux_amd64/libtensorflowlite_c.so
I am using TensorFlow.js and I am interested in gettings the embeddings instead of the logits of a pre-trained model just as described in https://github.com/tensorflow/tfjs-models/tree/master/mobilenet for MobileNet ('Getting embeddings')
With the classic MobileNet model loaded const model = await mobilenet.load()
you can use model.infer(image, 'conv_preds')
for example and it works fine and you can do your transfer learning.
Any advice would be appreciated !
Hello !
Looking to try tflite on node but can't manage to install it, do you have any highlight on this issue ? Thanks!
Context:
macOS 12; Intel; Node 14/16/18;
➜ folder git:(main) ✗ pnpm add tfjs-tflite-node @tensorflow/tfjs-core @tensorflow/tfjs-backend-cpu
Packages: +17 (current: {"node":"v14.19.2","pnpm":"7.0.1"})
+++++++++++++++++
node_modules/.pnpm/[email protected]_zdnedjtt7d7rx2jlpmkmix4wci/node_modules/tfjs-tflite-node: Running install script, failed in 2.7s
.../node_modules/tfjs-tflite-node install$ node-gyp rebuild
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | x64
│ gyp info find Python using Python version 3.9.12 found at "/Users/user/.asdf/installs/python/3.9.12/bin/python3"
│ gyp info spawn /Users/user/.asdf/installs/python/3.9.12/bin/python3
│ gyp info spawn args [
│ gyp info spawn args '/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py
│ gyp info spawn args 'binding.gyp',
│ gyp info spawn args '-f',
│ gyp info spawn args 'make',
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/user/project/folder/node_modules/.pnpm/[email protected]_zdnedjtt7d7rx2jlpmkmix4wci/node_modul
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/user/Library/Caches/node-gyp/14.19.2/include/node/common.gypi',
│ gyp info spawn args '-Dlibrary=shared_library',
│ gyp info spawn args '-Dvisibility=default',
│ gyp info spawn args '-Dnode_root_dir=/Users/user/Library/Caches/node-gyp/14.19.2',
│ gyp info spawn args '-Dnode_gyp_dir=/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_modules/pnpm/dist/node_modules/node-gyp'
│ gyp info spawn args '-Dnode_lib_file=/Users/user/Library/Caches/node-gyp/14.19.2/<(target_arch)/node.lib',
│ gyp info spawn args '-Dmodule_root_dir=/Users/user/project/folder/node_modules/.pnpm/[email protected]_zdnedjtt7d7rx2jlpmk
│ gyp info spawn args '-Dnode_engine=v8',
│ gyp info spawn args '--depth=.',
│ gyp info spawn args '--no-parallel',
│ gyp info spawn args '--generator-output',
│ gyp info spawn args 'build',
│ gyp info spawn args '-Goutput_dir=.'
│ gyp info spawn args ]
│ gyp info spawn make
│ gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
│ CXX(target) Release/obj.target/node_tflite_binding/binding/node_tflite_binding.o
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:74:3: error: cannot use
│ try {
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:93:3: error: cannot use
│ try {
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:461:3: error: cannot us
│ NAPI_THROW_IF_FAILED(*this, status, Object());
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:468:3: error: cannot us
│ NAPI_THROW_IF_FAILED(*this, status, Value());
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:475:3: error: cannot us
│ NAPI_THROW_IF_FAILED(*this, status, Value());
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:508:3: error: cannot us
│ NAPI_RETURN_OR_THROW_IF_FAILED(
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:113:3: note: expanded from
│ NAPI_MAYBE_THROW_IF_FAILED(env, status, type); \
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:110:3: note: expanded from
│ NAPI_THROW_IF_FAILED(env, status, type())
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:539:3: error: cannot us
│ NAPI_THROW_IF_FAILED_VOID(_env, status);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:65:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:551:3: error: cannot us
│ NAPI_THROW_IF_FAILED_VOID(_env, status);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:65:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:559:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, nullptr);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:599:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, false);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:618:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, napi_undefined);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:652:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, false);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:672:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, false);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:683:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, false);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:694:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, false);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:713:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, false);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:724:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, false);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:735:3: error: cannot us
│ NAPI_THROW_IF_FAILED(_env, status, false);
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:751:3: error: cannot us
│ NAPI_RETURN_OR_THROW_IF_FAILED(
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:113:3: note: expanded from
│ NAPI_MAYBE_THROW_IF_FAILED(env, status, type); \
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:110:3: note: expanded from
│ NAPI_THROW_IF_FAILED(env, status, type())
│ ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from
│ if ((status) != napi_ok) throw Napi::Error::New(env);
│ ^
│ fatal error: too many errors emitted, stopping now [-ferror-limit=]
│ 20 errors generated.
│ make: *** [Release/obj.target/node_tflite_binding/binding/node_tflite_binding.o] Error 1
│ gyp ERR! build error
│ gyp ERR! stack Error: `make` failed with exit code: 2
│ gyp ERR! stack at ChildProcess.onExit (/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_modules/pnpm/dist/node_modules/node
│ gyp ERR! stack at ChildProcess.emit (events.js:400:28)
│ gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
│ gyp ERR! System Darwin 21.4.0
│ gyp ERR! command "/Users/user/.asdf/installs/nodejs/14.19.2/bin/node" "/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_module
│ gyp ERR! cwd /Users/user/project/folder/node_modules/.pnpm/[email protected]_zdnedjtt7d7rx2jlpmkmix4wci/node_modules/tfjs-tf
│ gyp ERR! node -v v14.19.2
│ gyp ERR! node-gyp -v v8.4.1
│ gyp ERR! not ok
└─ Failed in 2.7s
Dear,
I am trying to integrate the code from the Coral codelab into the Node-RED application, to allow our community to detect objects fast in images (e.g. persons in IP cam images for video surveillance). Our current solution can already draw rectangles around detected objects (via tfjs), but I would like to add Coral support.
First I load the a pre-trained TfLite model for object detection (which I download from this site):
var modelUrl = "https://raw.githubusercontent.com/google-coral/test_data/master/tf2_ssd_mobilenet_v2_coco17_ptq_edgetpu.tflite";
const options = {delegates: [new CoralDelegate()]};
var tfLiteModel = await tflite.loadTFLiteModel(modelUrl, options);
Once the model is loaded, the input of my code is an image (as a NodeJs buffer):
var tf = require('@tensorflow/tfjs-node');
var img = tf.node.decodeImage(new Uint8Array(imgBuffer));
const expanded = tf.expandDims(img, 0);
const prediction = tfLiteModel.predict(expanded);
const percentage = tf.div(tf.mul(prediction, tf.scalar(100)), tf.scalar(255));
const data = percentage.dataSync();
However the tf.mul
throws following exception:
Error: Argument 'a' passed to 'mul' must be a Tensor or TensorLike, but got 'Object'
at convertToTensor (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:5433:15)
at mul_ (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:11026:14)
at Object.mul__op [as mul] (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:5485:29)
...
The prediction
object looks like this:
Noob question: does this mean perhaps that it has recognized 4 different classes of objects in my image, and that I need to loop these 4 tensors (simply via Object.keys(...))
? Which I then must map to a label, and somehow extract the coordinates of the bounding box?
It would also be nice if somebody could explain (in simple words ;-) ) why the expandDims(img, 0)
is required, and what the tf.div(tf.mul(prediction, tf.scalar(100)), tf.scalar(255))
is doing.
Thanks!!!
Bart Butenaers
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.