Skip to content

Squat counter game featured at Khipu 2023 running on a Raspberry Pi 4 together with a Coral TPU

License

Notifications You must be signed in to change notification settings

tryolabs/squat-wars

Repository files navigation

Squat Wars

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

preview.mp4

How to Install

  1. Clone the repository

    git clone [email protected]:tryolabs/squat-wars.git
    cd squat-wars
  2. Install poetry

    curl -sSL https://install.python-poetry.org | python -
    
  3. 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
  4. Install dependencies and download models

    poetry install
    sh setup.sh

How to Run

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

License

Copyright © 2022, Tryolabs. Released under the BSD 3-Clause.

About

Squat counter game featured at Khipu 2023 running on a Raspberry Pi 4 together with a Coral TPU

Resources

License

Stars

Watchers

Forks