Instructions to use facebook/cotracker3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- CoTracker
How to use facebook/cotracker3 with CoTracker:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Updated README.md
#3
by lvoursl - opened
123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869---
license: cc-by-nc-4.0
------license: cc-by-nc-4.0tags:- CoTracker- vision- cotracker---# Point tracking with CoTracker3
**CoTracker3** is a fast transformer-based model that was introduced in [CoTracker3: Simpler and Better Point Tracking by Pseudo-Labelling Real Videos](https://arxiv.org/abs/2410.11831).It can track any point in a video and brings to tracking some of the benefits of Optical Flow. You could read more about the paper on our [webpage](https://cotracker3.github.io/). Code is available [here](https://github.com/facebookresearch/co-tracker).
CoTracker can track:
- **Any pixel** in a video- A **quasi-dense** set of pixels together- Points can be manually selected or sampled on a grid in any video frame
## How to useHere is how to use this model in the **offline mode**:
```pip install imageio[ffmpeg]```, then:```pythonimport torch# Download the videourl = 'https://github.com/facebookresearch/co-tracker/raw/refs/heads/main/assets/apple.mp4'
import imageio.v3 as iioframes = iio.imread(url, plugin="FFMPEG") # plugin="pyav"
device = 'cuda'grid_size = 10video = torch.tensor(frames).permute(0, 3, 1, 2)[None].float().to(device) # B T C H W
# Run Offline CoTracker:cotracker = torch.hub.load("facebookresearch/co-tracker", "cotracker3_offline").to(device)pred_tracks, pred_visibility = cotracker(video, grid_size=grid_size) # B T N 2, B T N 1```and in the **online mode**:```pythoncotracker = torch.hub.load("facebookresearch/co-tracker", "cotracker3_online").to(device)
# Run Online CoTracker, the same model with a different API:# Initialize online processingcotracker(video_chunk=video, is_first_step=True, grid_size=grid_size)
# Process the videofor ind in range(0, video.shape[1] - cotracker.step, cotracker.step): pred_tracks, pred_visibility = cotracker( video_chunk=video[:, ind : ind + cotracker.step * 2] ) # B T N 2, B T N 1```Online processing is more memory-efficient and allows for the processing of longer videos or videos in real-time.
## BibTeX entry and citation info
```bibtex@inproceedings{karaev24cotracker3, title = {CoTracker3: Simpler and Better Point Tracking by Pseudo-Labelling Real Videos}, author = {Nikita Karaev and Iurii Makarov and Jianyuan Wang and Natalia Neverova and Andrea Vedaldi and Christian Rupprecht}, booktitle = {Proc. {arXiv:2410.11831}}, year = {2024}}```README.md+69-3