如何使用EfficientNet-Lite模型作为关键点回归的主干



我想使用EfficientNet Lite 0模型作为主干来执行关键点回归任务。然而,我在从Tensorflow Hub或官方GitHub存储库加载模型时遇到了困难。你能解释一下我该怎么做吗:

  • 从ImageNet导入带有检查点的Tensorflow中的此类模型
  • 修改网络的最后一层
  • 根据我的任务修改损失
  • 重新培训网络

我期待着应用高效精简版,因为我想将所有内容转换为TF-Lite。

TensorFlow Lite目前不支持EfficientNet Lite,但它们支持移动(CPU和GPU(友好的CenterNet。看看这个Colab,它演示了如何使用这个模型。

转换关键点模型的命令:

# Get mobile-friendly CenterNet for Keypoint detection task.
# See TensorFlow 2 Detection Model Zoo for more details:
# https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md
wget http://download.tensorflow.org/models/object_detection/tf2/20210210/centernet_mobilenetv2fpn_512x512_coco17_kpts.tar.gz
tar -xf centernet_mobilenetv2fpn_512x512_coco17_kpts.tar.gz
rm centernet_mobilenetv2fpn_512x512_coco17_kpts.tar.gz*
# Export the intermediate SavedModel that outputs 10 detections & takes in an 
# image of dim 320x320.
# Modify these parameters according to your needs.
python models/research/object_detection/export_tflite_graph_tf2.py 
--pipeline_config_path=centernet_mobilenetv2_fpn_kpts/pipeline.config 
--trained_checkpoint_dir=centernet_mobilenetv2_fpn_kpts/checkpoint 
--output_directory=centernet_mobilenetv2_fpn_kpts/tflite 
--centernet_include_keypoints=true 
--keypoint_label_map_path=centernet_mobilenetv2_fpn_kpts/label_map.txt 
--max_detections=10 
--config_override=" 
model{ 
center_net { 
image_resizer { 
fixed_shape_resizer { 
height: 320 
width: 320 
} 
} 
} 
}"
tflite_convert --output_file=centernet_mobilenetv2_fpn_kpts/model.tflite 
--saved_model_dir=centernet_mobilenetv2_fpn_kpts/tflite/saved_model

最新更新