Home Tapir Pytorch Inference
Post
Cancel

Open In Github

!vlcsnap-2024-08-26-13h58m08s098

Important

This is a strip down version of the original Tapir repository focused on inference.

  • Removed the JAX dependencies and the training code.
  • Make it easy to run in real-time even with a camera feed.
  • Converted tensors from 5D to 4D (only use one frame)
  • ⚠️⚠️⚠️ONNX Inference is very slow⚠️⚠️⚠️

Installation

1
2
3
git clone https://github.com/ibaiGorordo/Tapir-Pytorch-Inference.git
cd Tapir-Pytorch-Inference
pip install -r requirements.txt

License

The License of the original model is Apache 2.0: License

ONNX Export

⚠️⚠️⚠️ONNX Inference is very slow⚠️⚠️⚠️

1
python onnx_export.py

Arguments:

  • –model: Path to the model weights
  • –resolution: Input resolution (default: 640)
  • –num_points: Number of points (default: 1000)
  • –dynamic: Export with dynamic number of points (default: False)
  • –num_iters: Number of iterations, use 0 for faster inference, 4 for better results (default: 4)
  • –output_dir: Output directory (default: ./)

Examples

https://github.com/user-attachments/assets/457eeb57-9961-4022-9b15-55f1d9dc2260

Video inference:

1
 python example_video_tracking.py

Webcam inference:

1
 python example_webcam_tracking.py

References:

This post is licensed under CC BY 4.0 by the author.