Skip to content
Nat Lee

Keyboard shortcuts

Turn these off if they get in the way of a screen reader or voice control. The setting is saved in this browser.

1
Home
2
Work
3
Projects
4
About
5
Experience
/
Search projects
?
Show this panel

Computer Vision

Spin-off · Infortrend

OpenPose Wrist Heatmap

Where the wrists went, piled into one picture

Runs the body OpenPose model over a video and piles up where the wrists went into a heatmap. The repo name says hands; the model only ever knew about wrists.

Role
Creator & Maintainer
Period
2020 – 2021
Status
Completed
Categories
Vision & imagingAI & machine learning
Origin
Infortrend
Stack
  • Python
  • OpenPose
  • TensorFlow
  • tf-keras
  • OpenCV
  • NumPy
  • Shapely
  • Matplotlib
  • Docker Compose
OpenPose Wrist Heatmap, screenshot 1

Overview

A file-based demo that samples every 30th frame of a video, runs the six-stage body OpenPose network (19 heatmap and 38 part-affinity channels) at two scales, takes the lowest point of each arm/wrist region, keeps the points that fall inside configured polygon ROIs, and accumulates them into heatmap overlays saved as PNG files. It does not infer finger landmarks or hand articulation. The demo runs with Docker Compose on a CPU image with Python 3.12, TensorFlow 2.21 and tf-keras, loading the original Keras weights; the heatmap rendering derives from HeatMappy and the pose code from Open-Pose-Keras.

What it's good for

Turns a recorded video into one picture of where the activity was, with a single docker compose up, on CPU, and no web service to keep alive. Swap the polygons for your own zones and it's a starting point for seeing which parts of a scene get the most movement.

Diagrams

Main paths only. The edge cases stayed in the code.

The ROI coordinates live in a 215-pixel square. New camera, new homework.

Point at a box to see what it connects to.

  1. Open the video file(data/test.mp4) → Video opens?
  2. Video opens? → yes: Read the next frame → no: Stop with a clear error
  3. Read the next frame → Got a frame?
  4. Got a frame? → yes: Every 30th frame? → end of video: Frame one saved?
  5. Every 30th frame? → yes: Shrink and crop the frame → no, skip: Read the next frame
  6. Shrink and crop the frame(0.3 scale, 215 px square) → Run body OpenPose at two scales
  7. Run body OpenPose at two scales(scales 0.5 and 1) → Any arm regions found?
  8. Any arm regions found? → yes: Add them to the history → no: Lowest point of every region
  9. Add them to the history(nothing is ever forgotten) → Lowest point of every region
  10. Lowest point of every region(whole history, five pixels up) → Keep points inside the ROIs
  11. Keep points inside the ROIs(boundary points excluded) → Save the frame with heat
  12. Save the frame with heat(a PNG in tmp/) → next frame: Read the next frame
  13. Frame one saved? → yes: Summary heatmap on frame one → no: Stop with a clear error
  14. Summary heatmap on frame one(all points, no shift, no ROI)
  15. Stop with a clear error(no video, or no frames)

Features

  • Samples every 30th frame and runs pose inference at two scales
  • Wrist-region points from body pose (no finger landmarks)
  • Polygon ROIs combined as a union mask
  • Accumulated motion heatmaps saved as PNG overlays
  • Clear errors for missing, unreadable or empty videos
  • One-command run with docker compose up

The problem

  • Keeping the original Keras model and HDF5 weights loading on current TensorFlow
  • Overlapping ROI masks wrapping 8-bit pixel values and darkening the image
  • Being honest about what the model detects: wrists, not hands

What I did

  • Used tf-keras 2.21 with public Keras 2 layer imports, preserving the original architecture and weight loader
  • Combined ROI masks as a union and rebuilt them whenever the frame size changes
  • Documented the body model's 19 heatmap and 38 part-affinity channels in the README and on the cover

Results

  • Motion heatmaps for a whole video from a single Docker command
  • A reproducible CPU image on Python 3.12 and TensorFlow 2.21
Heat builds up frame by frame around the spots both wrists keep returning to.
Heat builds up frame by frame around the spots both wrists keep returning to.

What I learned

  • ROI coordinates live in the shrunk, cropped 215 × 215 frame, so a different camera means reviewing the crop and the polygons together.
  • The tests build the real network and check channels, masks and boundaries, but measure no pose accuracy; GPU runs and the original weights aren't revalidated.
  • A frame from the demo video with no heat on it, for comparison.
    A frame from the demo video with no heat on it, for comparison.
  • Vision & imagingAI & machine learning11 stars on GitHub

    Street Scene OCR

    Compare EasyOCR, RapidOCR and PaddleOCR on Traditional Chinese street signs, with text boxes, timings and a small public-domain benchmark.

    2026Completed
  • Spin-off · Infortrend
    Vision & imagingAI & machine learning11 stars on GitHub

    Face Wall Generator

    Tile a folder of face pictures into a seeded grid. Optionally crop faces with OpenCV’s YuNet detector before building the wall.

    2021Completed
  • Work · Infortrend
    Vision & imagingAI & machine learning

    Persona Tracking

    A camera next to a digital sign tracks the people in front of it, guesses gender and age group, notices who is actually looking, and picks the ad that fits them. Most people walk straight past.

    2019Completed