← All work
M1flex-pga

Flex-PGA: On-Device Workout Classification

2026Team of 5 · ECE 554 capstone
Flex-PGA: On-Device Workout Classification — screenshot

Consumer fitness apps either run vision on a phone CPU, where throttling and OS scheduling drop frames and miss reps, or stream video of your home to a server, adding latency and creating a permanent record of a private activity. Doing inference on-device fixes both: latency is bounded by hardware, and only 34 bytes of skeleton coordinates ever cross a bus.

A USB camera feeds frames to Google's pretrained MoveNet pose model, run through TFLite on the Zynq's ARM Cortex-A53 cores, reducing each frame to 17 body keypoints. The 34 (y, x) values are written over AXI-Lite into a custom FPGA peripheral that holds a 34→128→64→3 multilayer perceptron with int8 weights in on-chip BRAM. A hand-written SystemVerilog state machine drives a single DSP48E2 multiply-accumulate through the network and returns a class: push-up, squat, curl, or no pose. The ARM side overlays the skeleton, class, confidence, rep tally, and frame rate on a DisplayPort output.

Three decisions shaped the design. Using a pretrained pose model instead of an end-to-end CNN reduces a frame from hundreds of thousands of pixels to 34 numbers, which makes the classifier small enough to live in fabric. Int8 post-training quantization puts all 12,931 weights and biases in a single BRAM (1.6% of the device), maps each multiply onto one DSP48E2, and turns ReLU into a sign check on the accumulator. And one sequential MAC is enough: at about 1 ms per inference against a 100 ms frame budget, there was no reason to spend area on parallelism.

Measured against the spec, the fully on-device system hit 90% test-set accuracy (target above 85%) and missed two targets: 10 FPS throughput against a target of 15, and 15% rep-counting error against a target under 5%. The classifier itself runs in about 1 ms using 1.6% of BRAM; the system was bounded by pose estimation on the ARM cores. We demoed it running live at the department capstone showcase, where it was judged and voted on against other teams' projects.

My part was the ARM-side inference pipeline. The planned camera interface didn't work on our system, so I brought the camera up by pivoting from a MIPI PCam to USB/UVC, then built the pipeline on top of it: capture, TFLite MoveNet pose estimation, and the 34 keypoint values handed to the team's int8 classifier over its AXI4-Lite register interface, driven from Python on PYNQ at camera frame rate.

Separately from the shipped pipeline, I prototyped a Vitis AI DPU (DPUCZDX8G) build in Vivado. I cut it down to the B512 configuration to fit the ZU3 and set the PL clock to 200 MHz, a target chosen against what the application actually needed rather than the maximum achievable, then closed timing at that target. The system that ran at the showcase doesn't use it: pose estimation there is TFLite on the ARM cores.

SystemVerilogVivadoAXI4-LiteZynq UltraScale+PYNQPythonOpenCVTFLiteVitis AI
uptime 00:00holland hargens · portfolio rev Asect: top