我已经根据训练过的模型生成了一个.tflite模型,我想测试一下tfilte模型给出与原始模型相同的结果.
给出相同的测试数据并获得相同的结果.
我一直在尝试 TFLite 来提高 Android 上的检测速度,但奇怪的是我的 .tflite 模型现在几乎只检测 1 个类别。
\n\n我已经对重新训练 mobilenet 后获得的 .pb 模型进行了测试,结果很好,但由于某种原因,当我将其转换为 .tflite 时,检测结果相差甚远......
\n\n对于重新训练,我使用了Tensorflow for Poets 2中的 retrain.py 文件
\n\n我使用以下命令来重新训练、优化推理并将模型转换为 tflite:
\n\npython retrain.py \\\n--image_dir ~/tf_files/tw/ \\\n--tfhub_module https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/feature_vector/1 \\\n--output_graph ~/new_training_dir/retrainedGraph.pb \\\n-\xe2\x80\x93saved_model_dir ~/new_training_dir/model/ \\\n--how_many_training_steps 500 \n\nsudo toco \\\n--input_file=retrainedGraph.pb \\\n--output_file=optimized_retrainedGraph.pb \\\n--input_format=TENSORFLOW_GRAPHDEF \\\n--output_format=TENSORFLOW_GRAPHDEF \\\n--input_shape=1,224,224,3 \\\n--input_array=Placeholder \\\n--output_array=final_result \\\n\nsudo toco \\\n--input_file=optimized_retrainedGraph.pb \\\n--input_format=TENSORFLOW_GRAPHDEF \\\n--output_format=TFLITE \\\n--output_file=retrainedGraph.tflite \\\n--inference_type=FLOAT \\\n--inference_input_type=FLOAT \\\n--input_arrays=Placeholder \\\n--output_array=final_result \\\n--input_shapes=1,224,224,3\nRun Code Online (Sandbox Code Playgroud)\n\n我在这里做错了什么吗?准确性的损失从何而来?
\n