Tryolabs demo featured at Khipu 2023 consisting of a squat counter game running on a Raspberry Pi 4 together with a Coral TPU. The initial code was based on a TensorFlow Lite pose estimation example.
preview.mp4
-
Clone the repository
git clone [email protected]:tryolabs/squat-wars.git cd squat-wars
-
Install poetry
curl -sSL https://install.python-poetry.org | python -
-
Select Python
3.9.10
for your environment. If using pyenv, we suggest you do:pyenv shell 3.9.10 pyenv which python | xargs poetry env use
-
Install dependencies and download models
poetry install sh setup.sh
The game can be launched with the following command
poetry run python squat_wars/main.py
Additionally, there are a couple of flags that allow the behavior to be customized:
Argument | Description | Required | Default |
---|---|---|---|
--model |
Path to the model .tflite file |
No | squat_wars/models/movenet_thunder_tpu.tflite |
--camera |
Camera ID. Set to 0 for webcam | No | 0 |
Note A camera needs to exist for the game to work.
It should also support a resolution of
800x448
as it is the current default. If it doesn't, the resolution can be changed here.Also, only single pose movenet models are supported at the moment. The name of the supported models are:
- movenet_lightning
- movenet_thunder
- movenet_lightning_tpu
- movenet_thunder_tpu
An example with both flags would be the following
poetry run python squat_wars/main.py --camera 0 --model squat_wars/models/movenet_lightning.tflite
Copyright © 2022, Tryolabs. Released under the BSD 3-Clause.