tensorflowjs-converter

Uncaught (in promise) Error: Provided weight data has no target variable: block1_conv1_2/kernel

混江龙づ霸主 提交于 2020-06-25 21:42:06
问题 I am new to machine learning and I was following this blog on how to write a model with mobilenet. I managed to convert the .h5 file model and tried to implement it on my web app. Unfortunately, when I try to load the JSON model I get this error: Uncaught (in promise) Error: Provided weight data has no target variable: block1_conv1_2/kernel. Screenshot of the error on a browser I converted the .h5 model in the command line like so: tensorflowjs_converter --input_format keras model.h5

Importing TF model into TensorflowJS (trained in Python) fails: “Input 0 is incompatible with layer flatten: expected min_ndim=3, found ndim=2.”

亡梦爱人 提交于 2020-02-21 06:56:14
问题 Error in JS: Uncaught (in promise) Error: Input 0 is incompatible with layer flatten: expected min_ndim=3, found ndim=2. I have found threads for the same error from people trying to import pretrained models in keras/python (like VGG oder ResNets). For them it was mostly because of them still including the top layers of the model, so those threads unfortunately have nothing to do with my problem of fully importing a self-trained model from python in TensorflowJS. My code: Python code: model =

Importing TF model into TensorflowJS (trained in Python) fails: “Input 0 is incompatible with layer flatten: expected min_ndim=3, found ndim=2.”

妖精的绣舞 提交于 2020-02-21 06:54:07
问题 Error in JS: Uncaught (in promise) Error: Input 0 is incompatible with layer flatten: expected min_ndim=3, found ndim=2. I have found threads for the same error from people trying to import pretrained models in keras/python (like VGG oder ResNets). For them it was mostly because of them still including the top layers of the model, so those threads unfortunately have nothing to do with my problem of fully importing a self-trained model from python in TensorflowJS. My code: Python code: model =

Different results for tensorflowjs and keras on same model and tensor

て烟熏妆下的殇ゞ 提交于 2020-01-04 05:37:11
问题 I trained a CNN model on some images following the example of https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html. My model code is identical, I just trained it on another image dataset: also for classification between two classes. The results are what you'd expect on the training set: images are classified correctly either 0 or 1. I saved the model in a tensorflowjs-friendly format following the "Alternative: Use the Python API to export directly

Distinguish types of on-disk models

你。 提交于 2019-12-31 04:39:10
问题 Tensorflow has several types of model formats: TensorFlow SavedModel 2. Frozen Model 3. Session Bundle 4. Tensorflow Hub module How can you distinguish between them on-disk? (to later use with tensorflowjs-converter) And how is each model created? 回答1: Yup, there are a LOT of different model types, and they all have good reasons. I'm not going to claim that I have perfect clarity of each, but here's what I know (I think I know). The .pb file: PB stands for protobuff or Protocol Buffer. This

Difference between tfjs_layers_model and tfjs_graph_model

折月煮酒 提交于 2019-12-25 01:43:38
问题 The tensorflowjs converter has the output formats tfjs_layers_model , tfjs_graph_model What is the difference between the two? Is there a use recommendation? 回答1: There seem to be only certain pairs of input and output formats that work, namely `keras` | `tfjs_layers_model` `keras_saved_model` | `tfjs_layers_model` `tf_hub` | `tfjs_graph_model` `tf_saved_model` | `tfjs_graph_model` 来源: https://stackoverflow.com/questions/55829043/difference-between-tfjs-layers-model-and-tfjs-graph-model

Converting Python Keras NLP Model to Tensorflowjs

房东的猫 提交于 2019-12-24 19:19:50
问题 I'm trying to learn more about Tensorflowjs, but sadly I'm stuck getting my Keras NLP Model converted to Tensorflowjs. This is what I'm trying to convert: from keras.models import load_model from keras.preprocessing.sequence import pad_sequences import pickle list_classes = ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"] model = load_model('Keras_Model/m.hdf5') with open('Keras_Model/tokenizer.pkl', 'rb') as handler: tokenizer = pickle.load(handler) list_sentences

no add_to_collection was found when using tensorflowjs_converter

↘锁芯ラ 提交于 2019-12-24 07:38:34
问题 I am trying to convert a savedModel into TensorFlow.js web format. I installed tensorflowjs via sudo pip3 install tensorflowjs When running tensorflowjs_converter--input_path=full_path_to/saved_model/saved_model.pb --outputpath=full_path_to/js I get an error saying ImportError: cannot import name 'add_to_collection' Even if I run tensorflowjs_converter --help , I get the exact same error. Here is the full error: Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.6/site

tensorflow.js in webworkers

时间秒杀一切 提交于 2019-12-12 19:11:45
问题 I want to import 2 scripts in webWorker by importScripts() as follows,but it failed to import. How to deal with it? self.importScripts('https://cdn.jsdelivr.net/npm/@tensorflow/tfjs'); self.importScripts('https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter'); error figure 回答1: Currently, it is not possible to use the webgl implementation on web-worker, the offlineCanvas being an experimental features. However, it is possible to use the CPU backend. Here is an example of delegation to the

Convert output of retrain.py to tensorflow.js

匆匆过客 提交于 2019-12-12 16:05:49
问题 The script retrain.py described in How to Retrain an Image Classifier for New Categories was run as python retrain.py --tfhub_module https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/feature_vector/2 --image_dir /tmp/test and produced the output file /tmp/output_graph.pb . Converting this with tensorflowjs_converter --input_format=tf_saved_model --output_format=tfjs_graph_model /tmp/output_graph.pb /tmp/model failed with IOError: SavedModel file does not exist at: /tmp/output_graph.pb/