Close

Faster pose tracker

A project log for Auto tracking camera

A camera that tracks a person & counts reps using *AI*.

lion-mclionheadlion mclionhead 02/05/2022 at 04:250 Comments

There was a rumor that running a raspberry pi in 64 bit mode would make pose tracking run as fast as a GPU.  Sadly, raspberry pi production joined GPU production in valhalla so these notes won't be applicable to many animals.

Traditionally, 64 bit mode was slower because it entails moving a lot more data around.  That plagued IA64.  It might have an advantage in executing more parallel floating point operations.

The journey began by downloading ubunt 21 for raspberry pi 4.  It requires 4GB RAM & 16 GB of SD card. It required a keyboard, mouse, & monitor for installation, which the lion kingdom didn't have.  There's no minimal ubunt like there is for raspian.

There were some notes about enabling the UART console & bypassing the installation GUI.

https://limesdr.ru/en/2020/10/17/rpi4-headless-ubuntu/

but nothing useful for logging in.  The only way to log in was to edit /etc/shadow on another confuser, copying the password hash of a known password to the root password field.

Next came disabling some programs.  There might be a need to run X someday to test an LCD panel, so lions don't delete that anymore.

mv /usr/sbin/NetworkManager /usr/sbin/NetworkManager.bak

mv /usr/sbin/ModemManager /usr/sbin/ModemManager.bak

mv /usr/lib/xorg /usr/lib/xorg.bak

mv /sbin/dhclient /sbin/dhclient.bak

swapoff -a; rm /swapfile


Then create some network scripts.

ip addr add 10.0.0.16/24 dev eth0

ip link set eth0 up

ip route add default via 10.0.0.1

echo nameserver 75.75.75.75 > /etc/resolv.conf         

There's a new dance to make this run in /etc/rc.local

https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd

Most importantly, the default runlevel must be changed from oem-config.target to multi-user.target

systemctl set-default multi-user.target

Then install some sane programs as fast as possible.

apt update

apt install net-tools

apt install openssh-server

rm /var/cache/debconf/* if it dies because of some locking bug.

The instructions for setting up pose tracking were in 

https://community.element14.com/challenges-projects/element14-presents/w/documents/27468/episode-536-bonus-video---pose-detection-code

The movenet_lightning.tflite model ran at 8fps & detected just 1 animal at a time.  posenet.tflite ran at 5fps.  movenet_multipose.tflite crashed.  There was an alternative multipose model on

https://tfhub.dev/google/lite-model/movenet/multipose/lightning/tflite/float16/1

This one worked at 3fps.

The command for changing models was

python3 pose_estimation.py --model movenet_multipose

It wasn't close enough for rep counting, but just might be good enough for camera tracking.  Overclocking might get it up to 4fps.  As amazingly efficient as it is in getting the most out of the CPU, it's still too slow for the ultimate goal of photographing 2 people.  It's only good enough for tracking a single lion.  The next step would be fabricating a compact cooling system to overclock it & running face recognition.




Discussions