我看到的动物园.tflite型号的大小都不超过3MB。他们跑得很好。但是,当我训练我自己的对象检测模型时,.pb文件是60 my,.tflite也是20 my。它也是量化的如下所示。最终的结果是在edgetpu object_detection模型上分割错误。是什么导致这个文件这么大?非调整大小的图像被输入到模型中是否会导致模型很大(有些照片是4096×2160而不是调整大小)?
来自object_detection
训练模型
python train.py \
--logtostderr \
--train_dir=training \
--pipeline_config_path=training/ssd_mobilenet_v1_coco.config冻结图形-创建60 .pb的.pb文件
python export_tflite_ssd_graph.py \
--pipeline_config_path=training/ssd_mobilenet_v2_coco.config \
--trained_checkpoint_prefix=training/model.ckpt-2020 \
--output_directory=inference_graph \
--add_postprocessing_op=true 转换为.tflite -创建20 to的.tflite文件
tflite_convert
--graph_def_file=inference_graph/tflite_graph.pb \
--output_file=inference_graph/detect.tflite \
--inference_type=QUANTIZED_UINT8 \
--input_shapes=1,300,300,3 \
--input_arrays=normalized_input_image_tensor \
--output_arrays=TFLite_Detection_PostProcess,TFLite_Detection_PostProcess:1,TFLite_Detection_PostProcess:2,TFLite_Detection_PostProcess:3 \
--mean_values=128 \
--std_dev_values=127 \
--allow_custom_ops \
--default_ranges_min=0 \
--default_ranges_max=6在这个阶段,.tflite文件被推送到,并在连接到TPU的USB摄像头上试用该模型。
export DISPLAY=:0 && edgetpu_detect \
--source /dev/video1:YUY2:1280x720:20/1 \
--model ${DEMO_FILES}/detect.tflite最终结果是分割错误。
INFO: Initialized TensorFlow Lite runtime.
glvideomixer name=mixer background=black ! glimagesink sync=False name=glsink qos=False
v4l2src device=/dev/video1 ! video/x-raw,height=720,framerate=20/1,format=YUY2,width=1280 ! glupload ! tee name=t
t. ! glupload ! queue ! mixer.
overlaysrc name=overlay ! video/x-raw,height=720,width=1280,format=BGRA ! glupload ! queue max-size-buffers=1 ! mixer.
t. ! queue max-size-buffers=1 leaky=downstream ! glfilterbin filter=glcolorscale ! video/x-raw,height=168,width=300,format=RGBA ! videoconvert ! video/x-raw,height=168,width=300,format=RGB ! videobox autocrop=True ! video/x-raw,height=300,width=300 ! appsink max-buffers=1 sync=False emit-signals=True drop=True name=appsink
Segmentation fault发布于 2019-10-29 15:48:14
这里的问题可能是由于每个步骤都有两个不同的配置文件:
python train.py \
...
--pipeline_config_path=training/ssd_mobilenet_v1_coco.configpython export_tflite_ssd_graph.py \
--pipeline_config_path=training/ssd_mobilenet_v2_coco.config \
...这是注定的吗?而且,看起来在没有编译的情况下,您在培训后立即部署了模型。有关edgetpu_compiler:https://coral.withgoogle.com/docs/edgetpu/compiler/的更多信息,请参阅此文档
AFAIK,只要满足页面上列出的所有要求,20 on的型号就应该运行得很好:
(8位定点numbers).
你的整个管道应该是:
1)模型的训练
2)转换为tflite
3)为EdgeTPU编译的(实际将工作委托给TPU的步骤)
希望这能有所帮助。
https://stackoverflow.com/questions/58561680
复制相似问题