Retrain image detection with MobileNet

后端 未结 4 1157
执念已碎
执念已碎 2020-12-06 12:01

Several ways of retraining MobileNet for use with Tensorflow.js have failed for me. Is there any way to use a retrained model with Tensorflow.js?

Both using the mode

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 12:39

    To use the latest TFjs:

    python retrain.py --tfhub_module https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/feature_vector/2 \
        --image_dir /tmp/flower_photos --saved_model_dir /tmp/saved_retrained_model
    tensorflowjs_converter --input_format=tf_saved_model \
        --output_format=tfjs_graph_model \
        --saved_model_tags=serve \
        /tmp/saved_retrained_model/ /tmp/converted_model/
    

    creates a model.json file. Command described in https://github.com/tensorflow/tfjs-converter#step-1-converting-a-savedmodel-keras-h5-tfkeras-savedmodel-or-tensorflow-hub-module-to-a-web-friendly-format.

    Yet, loading the model with tf.loadLayersModel("file:///tmp/web_model/model.json") failed with

    'className' and 'config' must set.

提交回复
热议问题