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 就是框體的顏色 表示… 改改看吧 應該能行的…親測過了…

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