Conversation
When the HandGestureDetector custom block is used in a circuit, the Build & Download bundle must include its third-party runtime: - add mediapipe to requirements.txt through BLOCK_DEPENDENCIES (mediapipe is not a COMMON_PIP_ALIASES alias, so the AST sweep alone cannot rewrite it) - ship the hand_landmarker.task model with the generated ZIP through OPTIONAL_FILES, mirroring how FaceDetector bundles haar_cascade and ObjectDetector bundles yolov3 Release note: none needed; behavioral only for circuits using the MediaPipe hand-gesture block (VisualCircuit-resources#470).
Author
|
@jmplaza could you take a look when you get a chance? This bundles the MediaPipe hand_landmarker model so the HandGestureDetector block's synthesized project ZIP includes the model file (see OPTIONAL_FILES / BLOCK_DEPENDENCIES in backend/synthesis/synthesis.py). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes the backend side of the MediaPipe HandGestureDetector custom block
for the Build & Download flow, addressing the remaining bundling gap in
#470 (the block itself,
HandGestureDetector.vc3+hand_landmarker.task, isalready merged upstream via VisualCircuit-resources#17).
When a circuit that uses the hand-gesture block is built, the generated ZIP must
ship its third-party runtime and model. This PR wires that up by mirroring the
exact pattern already used for
FaceDetector(haar) andObjectDetector(yolov3):
requirements.txt— added'HandGestureDetector': ['mediapipe', 'opencv-python', 'numpy']toBLOCK_DEPENDENCIES.mediapipehas no entry inCOMMON_PIP_ALIASES, so theAST sweep alone would only add an unresolved
mediapipename; listing it hereguarantees the real pip package lands in the generated requirements file.
'HandGestureDetector': 'utils/models/hand_landmarker/**/*'toOPTIONAL_FILES, mirroring howFaceDetector/ObjectDetectorpull theirmodel assets into the ZIP (via the
paths_to_includewhitelist insyntheize_executioner, keyed off theoptional_files[script_name]flag setin
syntheize_modules).backend/staticfiles/synthesis/utils/models/hand_landmarker/hand_landmarker.task(7.6 MB, from Google's official MediaPipe model zoo — same convention as the
committed
yolov3-tiny.weights), plus aREADME.mdnoting source/license.Verification
Backend CI does not run tests, so correctness is verified locally:
python -m py_compile backend/synthesis/synthesis.py— passes.(
Path.relative_to('synthesis').match(...)against theOPTIONAL_FILESglobs, as done in
syntheize_executioner) against the on-diskhand_landmarker.taskpath:utils/models/hand_landmarker/**/*includes the model when theblock is present (
True),FaceDetector/ObjectDetectorexclude globs(
True),['mediapipe', 'opencv-python', 'numpy'].git diff origin/master...HEADtouches onlysynthesis.py(2 dict lines) andthe new model directory — no unrelated churn.
Notes
frontend block registration already shipped in VisualCircuit-resources#17.
since this branch was cut from current
master(7a42b74).Closes the bundling portion of #470.