Very happy the examples are now in Javascript. I now just make them useable without build tools.
If you want to send me some code I will see what I can do.
All the examples are already converted to pure javascript at
https://hpssjellis.github.io/beginner-tensorflowjs-examples-in-javascript/
tsc --target ES2017 --module none ./demos/mnist/mnist.ts
import * as tf from '@tensorflow/tfjs'; import {loadFrozenModel} from '@tensorflow/tfjs-converter'; const MODEL_URL = 'https://.../mobilenet/web_model.pb'; const WEIGHTS_URL = 'https://.../mobilenet/weights_manifest.json'; const model = await loadFrozenModel(MODEL_URL, WEIGHTS_URL); const cat = document.getElementById('cat'); model.execute({input: tf.fromPixels(cat)});
for the MODERL_URL and WEIGHTS_URL, I used relative file paths. Is that permitted or do I really have to serve the files from the cloud or it won't work? Any advice will be much appreciated. Thanks.
paths":[
"beginner-tensorflowjs-examples-in-javascript/tf-examples/Browser-Sentiment-Classification/group1-shard1of1"
],
sudo tensorflowjs_converter \
--input_format=tf_frozen_model \
--output_node_names='final_result' \
/Users/kihapper/dev_graduation/tensorflow_js/input/retrained_graph.pb \
/Users/kihapper/dev_graduation/tensorflow_js/output/webmodel
Error in matMul: inputs must be rank 2, got ranks 1 and 2.To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/2155bbd3-3c65-4f17-8022-b3dcf94b6f36%40tensorflow.org.--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+unsubscribe@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/db06d943-ecd0-4a2d-a665-632e6b22cd5c%40tensorflow.org.
python3 tensorflow/tensorflow/examples/image_retraining/retrain.py \
--image_dir=data/images \
--how_many_training_steps=600 \
--architecture mobilenet_0.25_224 \
--saved_model_dir=data/saved_model \
--output_graph=data/model_output/output_graph.pb \
--output_labels=data/model_output/output_labels.txt \
--summaries_dir=data/training_summary \
File Structure
├── images
│ ├── bicycle
│ ├── exit
│ ├── fire_extinguisher
│ ├── sphere_cam
│ └── square_cam
├── model_output
│ ├── output_graph.pb
│ └── output_labels.txt
├── saved_model
│ ├── saved_model.pb
│ └── variables
├── test_images
│ └── test_bike.jpg
├── training_summary
├── train
└── validation
Error--> "The name 'import/InceptionV3/Predictions/Reshape_1' refers to an Operation not in the graph."
output_layer = "InceptionV3/Predictions/Reshape_1" ---changed---> output_layer = "final_result"Error--> "Cannot feed value of shape (1, 299, 299, 3) for Tensor 'import/input:0', which has shape '(?, 224, 224, 3)"
input_height = 299 ---changed---> input_height = 224
input_width = 299 ---changed---> input_width = 224python3 tensorflow/tensorflow/examples/label_image/label_image.py \
--graph=data/model_output/output_graph.pb \
--labels=data/model_output/output_labels.txt \
--image=data/test_images/test_bike.jpg
2018-05-23 23:35:52.038675: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
bicycle 0.9918669
square cam 0.008131062
sphere cam 1.5137134e-06
exit 3.2000648e-07
fire extinguisher 1.1101035e-07 python3 tensorflow/tensorflow/examples/label_image/label_image.py \
--graph=data/saved_model/saved_model.pb \
--labels=data/model_output/output_labels.txt \
--image=data/test_images/test_bike.jpg
/Users/miniconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`. from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "tensorflow/tensorflow/examples/label_image/label_image.py", line 118, in <module>
graph = load_graph(model_file)
File "tensorflow/tensorflow/examples/label_image/label_image.py", line 31, in load_graph
graph_def.ParseFromString(f.read())
google.protobuf.message.DecodeError: Error parsing message
python3 -m tensorflowjs.converters.converter \
--input_format=tf_saved_model \
--output_node_names='final_result' \
--saved_model_tags=serve \
data/saved_model/ \
data/web_saved_model/ Uncaught (in promise) Error: Error in matMul: inputs must be rank 2, got ranks 1 and 2.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/64cd7e24-9241-4580-b076-64eeed79c5bf%40tensorflow.org.
├── web_frozen_model
│ ├── group1-shard1of1
│ ├── tensorflowjs_model.pb
│ └── weights_manifest.json
└── web_saved_model
├── group1-shard1of1
├── tensorflowjs_model.pb
└── weights_manifest.json2018年5月24日木曜日 11時56分56秒 UTC-4 Ping Yu:
Is working again using v10.3 not working on v11.2