所有命令都在mediapipe根目录执行
1.将大小为640*640的png图片放入/media/picture/
2.修改该文件可以配置图片大小
nano mediapipe/graphs/template_matching/template_matching_mobile_cpu.pbtxt
3.生成knift索引文件
bazel命令1
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 \
mediapipe/examples/desktop/template_matching:template_matching_tflite
bazel命令2
bazel-bin/mediapipe/examples/desktop/template_matching/template_matching_tflite \
--calculator_graph_config_file=mediapipe/graphs/template_matching/index_building.pbtxt \
--input_side_packets="file_directory=/media/picture/,file_suffix=png,output_index_filename=my_knift_index.pb"
4. 通过编译2在根目录下生成my_knift_index.pb 将其替换默认模板索引文件
cp my_knift_index.pb mediapipe/models/knift_index.pb
5.更新识别描述文件txt
nano mediapipe/models/knift_labelmap.txt
6.bazel编译打包,输出apk安装文件
bazel build -c opt --config=android_arm64 --linkopt="-s" mediapipe/examples/android/src/java/com/google/mediapipe/apps/templatematchingcpu:templatematchingcpu
7.识别效果