How to build custom mediapipe python model i.e. adding flow_limiter_calculator to face_landmark_front_cpu.binarypb

28 views
Skip to first unread message

Juahn Cho

unread,
Mar 29, 2024, 9:37:42 PMMar 29
to MediaPipe
I'm trying to add `flow_limiter_calculator` to `face_landmark_front_cpu.binarypb` as I realized python model doesn't have `flow_limiter_calculator` in its original `face_landmark_front_cpu.pbtxt`

What I did was simply adding below to `mediapipe\graphs\face_mesh`

```
mediapipe_binary_graph(
    name = "face_mesh_python_model",
    graph = "face_mesh_python_model.pbtxt",
    output_name = "face_mesh_python_model.binarypb",
    linkstatic = 1,
    deps = [
        "//mediapipe/calculators/core:constant_side_packet_calculator",
        "//mediapipe/calculators/core:flow_limiter_calculator",
        "//mediapipe/modules/face_landmark:face_landmark_front_gpu"
    ]
)
```

and build with

```
build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH=%PYTHON_PATH_311%/python.exe mediapipe/graphs/face_mesh:face_mesh_python_model  --verbose_failures
```

The build was success. However, my intuition says such information inside binarypb, which was interestingly readable, won't do anything other than there is something completely wrong

```
[face_mesh_python_model.binarypb]

`FlowLimiterCalculatorinput_videoFINISHED:output_video"throttled_input_videoj
FINISHED
šConstantSidePacketCalculator2PACKET:0:num_faces2PACKET:1:with_attentionBM
Atype.googleapis.com/mediapipe.ConstantSidePacketCalculatorOptions


ƒFaceLandmarkFrontCpuIMAGE:throttled_input_video"LANDMARKS:multi_face_landmarks"-ROIS_FROM_LANDMARKS:face_rects_from_landmarks"DETECTIONS:face_detections"/ROIS_FROM_DETECTIONS:face_rects_from_detections*NUM_FACES:num_faces*WITH_ATTENTION:with_attentionRinput_videozmulti_face_landmarkszface_rects_from_landmarkszface_detectionszface_rects_from_detections
```

Can somebody guide me to how I can properly build a customized mediapipe python model with the above specification?
Reply all
Reply to author
Forward
0 new messages