tensorflow.js

Import Python Keras model with weights into Tensorflow.js

十年热恋 提交于 2020-02-06 18:52:34
问题 I have some neural networks for the classification of images developed in Python 3.7 using the Keras package that is included in TensorFlow and I want to export the layers and weights model to import it in a Node.js application that uses Tensorflow.js. I have the neural networks saved in h5 format with two separate files, one for the layer model and the other for the weights model. Try to follow this tutorial that Tensorflow proposes (https://www.tensorflow.org/js/tutorials/conversion/import

Import Python Keras model with weights into Tensorflow.js

只谈情不闲聊 提交于 2020-02-06 18:50:19
问题 I have some neural networks for the classification of images developed in Python 3.7 using the Keras package that is included in TensorFlow and I want to export the layers and weights model to import it in a Node.js application that uses Tensorflow.js. I have the neural networks saved in h5 format with two separate files, one for the layer model and the other for the weights model. Try to follow this tutorial that Tensorflow proposes (https://www.tensorflow.org/js/tutorials/conversion/import

new shape and old shape must have the same number of elements

女生的网名这么多〃 提交于 2020-01-24 03:47:25
问题 For learning purpose, I am using Tensorflow.js, and I experience an error while trying to use the fit method with a batched dataset (10 by 10) to learn the process of batch training. I have got a few images 600x600x3 that I want to classify (2 outputs, either 1 or 0) Here is my training loop: const batches = await loadDataset() for (let i = 0; i < batches.length; i++) { const batch = batches[i] const xs = batch.xs.reshape([batch.size, 600, 600, 3]) const ys = tf.oneHot(batch.ys, 2) console

Running object detection using Tensorflow.js

谁说胖子不能爱 提交于 2020-01-21 19:16:52
问题 I am working on object detection using Tensorflow.js. I am trying to run custom object detection tensorflow.js model in a browser. I could able to convert tensorflow model to tensorflow.js model (in google colab) using the following command: !tensorflowjs_converter \ --input_format=tf_frozen_model \ --output_node_names='detection_boxes,detection_scores,detection_classes,num_detections' \ /content/frozen_inference_graph.pb \ /content/web_model I am sharing the code snippet of inference.html

“Unknown layer: Lambda” in tensorflowjs on browser

為{幸葍}努か 提交于 2020-01-14 19:42:27
问题 I am new in machine learning area. i am trying to run python program on browser by converting trained model in tensorflow js. this attention_ocr is related to OCR written in python. i have generated HDF5/H5 file and converted that in web specific format with tensorflowjs_converter [ref]. I follow all instruction given in this document but at the time of running in browser it throwing me error (refer screenshot) I am looking for solution to remove this error...! Referance : tensorflow.org How

How to save a Tensorflow.js model?

柔情痞子 提交于 2020-01-13 09:57:05
问题 I would like to make a user interface that creates,saves and trains tensorflow.js models. But i can't save a model after creating it. I even copied this code from the tensorflow.js documenation but it does't work: const model = tf.sequential( {layers: [tf.layers.dense({units: 1, inputShape: [3]})]}); console.log('Prediction from original model:'); model.predict(tf.ones([1, 3])).print(); const saveResults = await model.save('localstorage://my-model-1'); const loadedModel = await tf.loadModel(

Fully Convolutional Network

╄→尐↘猪︶ㄣ 提交于 2020-01-06 07:55:10
问题 TensorFlow.js version tfjs-node-gpu 0.2.1 Describe the problem or feature request I'm trying to make a supervised fully convolutional network and am not able to generate appropriate outputs. The net structure is based on several FCN examples done, specifically this one: http://deeplearning.net/tutorial/fcn_2D_segm.html I've put the mask in a one-hot 4d boolean vector with the order of [batch, height, width, class] with only a single class. The input data is altered to a float32 tensor of

tf.browser.fromPixels returns only zeros

不问归期 提交于 2020-01-06 06:23:07
问题 Here tf.browser.fromPixels returns a tensor with only zeros. image.data contains values as expected (not only zeros). tfjs is loaded using a script tag. tfjs 1.0.0 but changing release does not help. What can be wrong? Probably something stupid. I am new to Tensorflow.js... <canvas id="canvas" width="100" height="100" style="border:1px solid #FF0000;"></canvas> .... var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); var image = ctx.getImageData(0, 0, canvas

Alternative for Lambda layer in yolo3 Keras

不羁的心 提交于 2020-01-05 04:09:20
问题 My Goal I want to train a custom object detection model in Tensorflow(python) and use it using Tensorflow js after digging lot of example I found this which is widely popular What I have done I have written ( taken help form online examples ) the Tensorflow JS part to load a model from local and get the get the predictions. I used with COCO pretrained model It is working fine (so not adding the code here). What is my problem I am very new to python and Tensorflow. The example for training

Tensorflow.js: tf.pad results in TypeError: t.map is not a function

谁说我不能喝 提交于 2020-01-05 04:09:07
问题 This code is from the TF API docs: let t = tf.tensor([[1, 2, 3], [4, 5, 6]]) let padding = tf.tensor([[1, 1,], [2, 2]]) When I execute it: tf.pad(t, padding, "CONSTANT") I get: TypeError: t.map is not a function I'm using the latest version of tfjs. 回答1: padding is a normal js array of tuples ( array of arrray) and not a tensor. As for now, the version 1.3.1, only the CONSTANT mode is supported. Here is the way to go: let t = tf.tensor([[1, 2, 3], [4, 5, 6]]) let padding = [[2, 2,], [1, 1]]