mediapipe中 怎么更改 人脸检测中的 框体颜色?

我们 以 examples 的为 例子
android/src/java/com/google/mediapipe/apps/facedetectiongpu的
BUILD文件,描述了apk 生成的条件:

我们可以看到: 75 line
android_binary(
name = “facedetectiongpu”,
manifest = “AndroidManifest.xml”,
manifest_values = {“applicationId”: “com.google.mediapipe.apps.facedetectiongpu”},
multidex = “native”,
deps = [
“:mediapipe_lib”, //<<<------------------------------------step 1 这个android apk 依赖于这个mediapipe_lib------>>>
],
)

然后…看到这里 45 line
android_library(
name = “mediapipe_lib”,
srcs = glob(["*.java"]),
assets = [
“:binary_graph”, //<<<----------------------------- step 2------>>>
“//mediapipe/models:face_detection_front.tflite”,
“//mediapipe/models:face_detection_front_labelmap.txt”,
],
assets_dir = “”,
manifest = “AndroidManifest.xml”,
resource_files = glob([“res/**”]),
deps = [
—… … … 省略了 …
],
)

再 然后就 是这里 啦:
genrule(
name = “binary_graph”, //<<<----------------------------- step 3 ----->>>>//
srcs = ["//mediapipe/graphs/face_detection:mobile_gpu_binary_graph"],
outs = [“facedetectiongpu.binarypb”],
cmd = “cp $< $@”,
)

然后就是

在 graphs /face_detection下
BUILD文件 : 50 line
mediapipe_binary_graph(
name = “mobile_gpu_binary_graph”, // 对应了 step 3 中的 srcs 路径 …
graph = “face_detection_mobile_gpu.pbtxt”, // <<------------------------- step 4------>>>>
output_name = “mobile_gpu.binarypb”,
deps = [":mobile_calculators"],
)

好,我们最终 来到了 这个 文件:
face_detection_mobile_gpu.pbtxt

可以知道这么 一个注释:

Converts the detections to drawing primitives for annotation overlay.

这句的注释大概意思 就是 转换 检测结果 绘制 覆盖, 哈哈 英文不好, 不好意思…
这块 有个node
node_options: {
[type.googleapis.com/mediapipe.DetectionsToRenderDataCalculatorOptions] {
thickness: 10.0
color { r: 255 g: 0 b: 0 }
}
}
没错了,这color 就是框体的颜色 表示… 改改看吧 应该能行的…亲测过了…

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章