How smaranjitghose/movenet works
Project Type & Purpose
• This is a stand-alone Python pose-detection script that reads a video (or camera feed), runs TensorFlow Lite MoveNet Lightning SinglePose inference, draws the 17 keypoints and skeleton edges, and writes out (or displays) the annotated video.
Main Architectural Components
a. Input Module (Green parallelogram)
• Sources:
• File input: assets/input/demo.mp4 (or any other video via input_video_path)
• Camera capture: cv2.VideoCapture(0 or 1) for live feed
• Responsibility: Read raw video frames.
b. Preprocessing Component (Blue rectangle)
• Resize frame to model’s input size
• Normalize pixel values
• Convert to the tensor format required by TFLite Interpreter
• Model artifact: models/movenet_singlepose_lightning.tflite
• Runtime: TensorFlow Lite Interpreter
• Responsibility: Run single-pose detection per frame, output a 17×3 array of (y, x, score).
d. Postprocessing Component (Blue rectangle)
• Filter keypoints by confidence threshold (configurable in code)
• Normalized coordinates back to original frame dimensions
e. Visualization Module (Blue rectangle)
f. Output Module (Green parallelogram)
• File writer: cv2.VideoWriter to assets/output/result.mp4
• OR real-time display window via cv2.imshow
Relationships & Data Flow
Input → Preprocessing → Inference Engine → Postprocessing → Visualization → Output
• Branch from Input to “Live Capture” and back into Preprocessing to show optional real-time mode
Key Design Principles & Patterns
• Pipeline pattern: clearly separated stages for readability and maintainability
• Configurability: threshold and input source parameters centralized in main.py
Technologies & Frameworks
• Python3 (main.py)
• OpenCV (cv2) for I/O, preprocessing, drawing, and video writing
• numpy for tensor manipulation
• tflite-runtime or TensorFlow Lite Interpreter for model inference
• requirements.txt lists exact versions