1,572 questions
1
vote
0
answers
67
views
How do I convert TensorFlow SavedModel into TensorFlow.js format?
I’m trying to convert my TensorFlow SavedModel into a TensorFlow.js format using tensorflowjs_converter.
tensorflowjs_converter --input_format=tf_saved_model --output_format=tfjs_graph_model --...
0
votes
1
answer
39
views
Custom TFJS layer no trainable variables found during training
I made a custom layer in TensorFlow.js that consists of sublayers but not weights of its own. Here is a simplified example
import * as tf from "@tensorflow/tfjs";
import { LayerArgs } from &...
0
votes
0
answers
59
views
How to enable metal is being used by tensorflow.js with node/Bun
Please comment how to enable Metal with tfjs-node on MacOS
+Metal isn't ready with tensorflow (c++) on the server side.
bun ./verify-backend.js
const tf = require('@tensorflow/tfjs-node');
async ...
1
vote
1
answer
53
views
Quantizing tfjs model to float16 ValueError: Missing output_path argument
I'm trying to quantize a tfjs model to float16 from the standard float32. This is how I loaded my .keras model and converted it to tfjs. This part works.
keras_input_file_path = '/content/cnn_model....
0
votes
0
answers
54
views
TensorflowJS: Model load Value Errors
I'm currently trying to load a tensorflow js model in a React app:
const modelPromise = tf.loadLayersModel('/assets/models/tfjs_model/model.json')
However, whenever I use the model I receive the ...
0
votes
0
answers
44
views
Camera.Constants.Type.back not working with cameraWithTensors and Expo Camera 13.9.0 in TensorFlow.js
I read the documentation of tensorflow-js and various tutorials and used the "cameraWithTensors" from the tfjs library like shown below:
const TensorCamera = cameraWithTensors(Camera);
...
2
votes
2
answers
57
views
how to load a tensorflow model using tensorflowjs
i was building a simple demo that would load a model that i have converted a JSON and binary using tensorfjs. The model is utilizing the following architecture
model = Sequential([
Flatten(...
1
vote
0
answers
27
views
Error: Error in gradient for op BatchMatMul. The gradient of input 'b' has shape 'b,s,h', which does not match the shape of the input 's,h' #8548
I implemented a definition layer and model using TensorFlowJS, and encountered a problem during training. The code is as follows. Can anyone help solve this problem? Thank you very much
I implemented ...
0
votes
0
answers
23
views
Tensorflow js feed not available in Android phone
I am following this tutorial creating a Tensorflow.js object detection system.
The full code is also available here.
The App.js code:
// Import dependencies
import React, { useRef, useState, useEffect ...
0
votes
0
answers
73
views
error when passing tensor to tensorflow.js model deployed on node-red TypeError: Cannot read properties of undefined (reading 'backend')
I have deployed a deep learning model on node-red. Originally a keras file that was later converted to a model.json format with its .bin shard files.
Using node-red-contrib-tf-model i deployed this ...
-1
votes
1
answer
49
views
Get Object Detection results from Edge export TFJS model, bin & dict in Express/Node API
I have exported my VertexAI model to TFJS as "edge", which results in:
dict.txt
group1_shard1of2.bin
group1_shard2of2.bin
model.json
Now, I send an image from my client to the Node/Express ...
1
vote
1
answer
82
views
LogVar layer of a VAE only returns zeros
I'm building a Variational auto encoder (VAE) with tfjs.
For now I'm only exploring with the fashionMNIST dataset and a simple model as follows:
input layer (28*28*1)
flatten
intermediate_1 (dense 50 ...
0
votes
0
answers
10
views
TypeError: prediction.argMax is not a function
Using tensor flow.js for deploy model...
Model get [1,63]
I can't fix problem "const predictedClass = prediction.argMax(1).dataSync();"
async function predictGesture(coordinates) {
if (!...
0
votes
0
answers
84
views
Force TouchDesigner to use a specific python version
I'm running Windows10.
For my project I have to use Python 3.10 with tensorflow-directml, torchvision and other deep learning tools.
The following is a link to one of the many guides about this topic:
...
1
vote
0
answers
66
views
YOLOv8 Hand Detection Fails at Close Range After TensorFlow.js Conversion
I'm using YOLOv8 for real-time hand detection in a web app. The model works well in Python, but after converting it to TensorFlow.js, detection struggles when the hand is too close to the webcam—...
-1
votes
1
answer
50
views
AWS IVS client not getting background video blur and only rendering first frame
I am working on an Angular 15 application where I apply a background blur effect to a video stream using CanvasRenderingContext2D and MediaPipeSelfieSegmentation (from bodySegmentation) for real-time ...
1
vote
0
answers
74
views
Converting tensorflow model using tensorflowjs
Trying to convert a simple CNN using tfjs. The model gets converted, however it does not get loaded in properly. Error: 'An InputLayer should be passed either a batchInputShape or an inputShape.'
tf....
1
vote
0
answers
147
views
How to leverage pyannote / speaker-diarization-3.0 with Transformers.js?
pyannote/segmentation-3.0 suggests to use pyannote/speaker-diarization-3.0 since it has better embedding model for diarization. I am trying to use this in client-side JS. It seems like I am supposed ...
0
votes
0
answers
18
views
Not getting expected results when loading tensorflowjs model
Followed this guide to create a tensorflow.js neural network https://medium.com/@GeorgePerry/finding-intent-to-buy-from-instagram-comments-with-tensorflow-js-3f764c132be7
It works prefectly until I ...
2
votes
0
answers
22
views
Tensorflow Matrices match error when applying gaussian blur module
I am having a problem with the gaussian blur of tensorflow.js.
Tried to apply the gaussian blur to a video but the best I can do is get the colors inverted.
The 5 by 5 matrix kernel I have seems to ...
1
vote
1
answer
129
views
How to Change the Default Background of bodySegmentation-mask-body-parts in p5.js?
I'm trying to change the background behind the detected body segment, but I can't get it to work. Even though I'm modifying the background(...) function, it keeps defaulting to white. Can anyone ...
1
vote
0
answers
138
views
tensorflowjs loadLayersModel function throwing ValueError: An InputLayer should be passed either a `batchInputShape` or an `inputShape`
heres my code for generating and training the model https://github.com/JaylenLuc/Terrestrial-based-ML-cloud-classification/blob/main/cloud.ipynb
I specified the input shape in the VGG16 model yet ...
1
vote
1
answer
136
views
Converted Model Using TensorFlow.JS Converter Not Working
I was following the TFJS WebML YT Course from Jason Mayes and following along to the TFJS Converter video, here's my notebook:
Google Colab Notebook
Basically it is an exact replica from the video and ...
0
votes
1
answer
55
views
Tensorflowjs keras model node weights aren't recognized
I'm facing an error when calling a pre-trained keras model in javascript for a simple web app on Heroku.
https://digit-predictor-6ba58c0cd85a.herokuapp.com
Unhandled Promise Rejection: Error: ...
1
vote
0
answers
222
views
TensorFlow.js with Expo Camera not processing frames in React Native
I have the following React Native App.js File where I'm trying to print nextImageTensor received, but the flow is not going inside loop(). As a matter of fact loop is not even getting called
App.js
...
1
vote
1
answer
79
views
TensorFlow JS : model.predict() provoke undefined on 'backend' because of an error within the library tensorflow : engine.ts:425 that cause undefined
Thanks for taking the time to read my problem 👍
System information
OS Platform and Distribution : Windows 10
TensorFlow.js installed from (npm or script link): npm
TensorFlow.js version (use command ...
2
votes
2
answers
186
views
different predictions on same data, TenserflowJS
I have saved a TFJS model to a document in cloud firestore, if I run this code straight from the browser:
const jsonObject = JSON.parse(TFModeljson);
loadedModel = await
tf.loadLayersModel(tf.io....
1
vote
0
answers
98
views
Mobile inference in a React Native App: use tensorflow in a native module or use directly Tensorflow.js in React Native?
I want to performance a face detection + face recognition in a React Native App offline, so I need to do my inference directly on mobile. I see that are many ways to do that, such as with Tensorflow....
0
votes
0
answers
250
views
input_shape error while converting tensorflow model to tensorflow.js model
I want to use my deep learning CNN algorithm in a web application and I converted my tensorflow model, emotion_model.h5 to a tensorflow.js model using this command in the terminal
...
0
votes
0
answers
367
views
Cannot install Tensorflowjs
I have a keras machine learning model titled "melanoma_binary_classifer.keras", and I am trying to convert it to tf.js layer format, and load it into tensorflow.js. I am doing this by ...
1
vote
0
answers
75
views
cannot back propagate on multi head attention tensorflowjs
I am trying to create a multi-head attention using tensorflowjs. When trying to train the model, an error kept popping up that the gradient shape was inconsistent with the input shape.
reproducable ...
0
votes
0
answers
40
views
Converting Model Saved by tfjs-react-native to Keras or Saved Model
I am having difficulties in converting a model saved by tfjs-react-native to a Keras or TF_Saved_Model format using tensorflowjs_converter. My intention is to use federated learning to train a global ...
1
vote
0
answers
125
views
Getting a domain/app's categories by quering the chrome://topics-internals/ Classifier directly
Chrome's Topics API's internal tool chrome://topics-internals/ has a Classifier that can list which categories a domain/app belongs to, as determined by an offline file (which is shipped with Chrome) ...
0
votes
2
answers
922
views
Need to convert Keras model to TensorFlow.js but facing version compatibility issues between TensorFlow and Keras
When I tried to convert a .h5 model by using this command in the terminal
tensorflowjs_converter --input_format keras model.h5 ./folder
I got an output that says "ValueError: Expected Keras ...
0
votes
0
answers
163
views
Porting TimesNet from PyTorch to Tensorflow.js
I want to use part of the Time Series Library, namely TimesNet on Tensorflow.js. How can I do this?
This requires knowledge of PyTorch, Python and mathematics.
Source code https://github.com/thuml/...
2
votes
2
answers
166
views
Why Tensorflow.js based Weather Prediction Model is unable to predict correct weather
I am learning tensorflow.js and this is perhaps the first full program I am trying to write. However I feel something is wrong. My model is not able to predict right Weather and always predicting '...
1
vote
0
answers
57
views
How to make Tensorflowjs converter work for .pb files?
I am trying to convert my .pb file (Frozen model format) to TensorFlow.js graph model format. I followed the instructions in the tfjs_converter documentation. So the command that I am running on my ...
0
votes
1
answer
208
views
face detection with reactjs
I have simple react app which has three buttons one to start the camera feed, one to capture an image and displays it and one to detect face(s) in that image and add a box around the face with the ...
3
votes
4
answers
4k
views
An InputLayer should be passed either a `batchInputShape` or an `inputShape`
I saved a CNN model using tfjs. But when I tried to load the model in js I got the following error
tfjs Uncaught (in promise) Error: An InputLayer should be passed either a `batchInputShape` or an `...
0
votes
1
answer
118
views
How to save model and load model in ReactJS
im follwing the transfer learning course of tensorflowjs on youtube. Im trying to make a model recognize some picture i upload. The problem is when i close window or reload, the model is load from ...
0
votes
1
answer
703
views
ERROR Error: Cannot find native module 'ExponentGLObjectManager', js engine: hermes
I'm trying to classify maize leaf diseases using a react native cli offline. l used teachable machine to train a simple machine learning model for 4 classes and have downloaded the tensorflow.js ...
0
votes
1
answer
111
views
tensorflow.js loadLayersModel fetch failed
I want to use the model I trained with tensorflow, but I'm getting errors. Please help me
const tf = require("@tensorflow/tfjs");
const path = require("path")
const MODEL_PATH = &...
1
vote
0
answers
290
views
Error dumping weights duplicate weight name kernel (tensorflow keras to tensorflowJS export)
I'm having problems to export a simple tensorflow model to a tensorflowjs model, currently I have read the official documentation about recomendations and found the next:
ERROR OUTPUT
failed to ...
0
votes
1
answer
76
views
How can I get the current frame of an HTML video as a JavaScript array?
On the press of a button, I would like to convert the current video frame from the webcam to an array or tfjs tensor.
I am unable to find a way to:
Get the array
Crop and resize the array to the ...
0
votes
0
answers
73
views
Error trying to predict in TensorFlow.js and react
I have an error when I try to predict with an LSTM model in React with TensorFlow.js. The purpose of the React project is to translate sign language and I use media pipe holistic to detect key points ...
0
votes
0
answers
155
views
How can I package tensorflow/tfjs-node in an electron app using electron-forge?
I'm trying to package @tensorflow/tfjs-node in an electron project. Everything works properly when I run electron locally, but when I try to package it using electron-forge I get an error
An unhandled ...
1
vote
1
answer
673
views
Tensorflow.js Error: Backend name ‘webgpu’ not found in registry when not served on localhost
I am working on getting a local server set up that can serve pages that will have access to tensorflow.js and the webGPU backend.
I have run into an issue where if I serve my files on localhost (127.0....
2
votes
0
answers
73
views
tfjs: Adam learning rate decay
How do I train a Tensorflow model using Adam optimizer that decays learning rate during the trining with Tensorflow.JS! (not python) I cannot find that the library provides an exponential decay ...
0
votes
1
answer
22
views
TF JS crash in engine.ts
I have a JS app which is internally using the TensorFlow.js to run inference on two models. The first model is a GraphModel that consists of 126 nodes. And the second is a LayersModel that consists of ...
0
votes
1
answer
82
views
tfjs-node training vs tfjs browser predictions giving NaN
I have a trained classification model in tfjs-node that exports a model.json and weights.bin file. When I execute it from the Terminal it works just fine and returns correct prediction probabilities ...