Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fea: release 0.3.0 #28

Merged
merged 8 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- 'develop'
- 'dev'
pull_request:
branches:
- '*'
Expand Down Expand Up @@ -32,4 +32,7 @@ jobs:
poetry install

- name: Run Pre commit hooks
run: make format-code
run: make format-code

- name: Run Tests
run: poetry run pytest tests
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,13 @@ dmypy.json
.pyre/

# Poetry
poetry.lock
poetry.lock

# model
*.pt

# images
*.png

# videos
*.mp4
77 changes: 77 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 🧑‍💻 Contributing to bytetrack

## How to contribute

### Issues, Pull Requests and Code Reviews.

Issues and Pull requests templates are mandatory.

At least one code review is needed to merge. Please merge your feature branches on `develop`.

We try to rebase as much as possible and use squash and merge to keep a linear and condensed git history.

### Getting started

This project uses [Poetry](https://python-poetry.org/) for dependency management. Poetry's doc is really good, so you should check it out if you have any questions.

To install poetry:

```bash
make download-poetry
```

You can start by creating a virtual environment (conda or other) or use poetry venv(please check the Makefile first if so, as poetry venv is deactivated there). Then, to install the project dependencies, run the following command:

```bash
make install
```

To develop, you will need dev requirements too. Run:

```bash
make install-dev-requirements
```

!!! note "About poetry.lock"
`poetry.lock` is not committed deliberately, as recommended by Poetry's doc. You can read more about it [here](https://python-poetry.org/docs/basic-usage/#as-a-library-developer).

### Codestyle

This projects uses [Black](https://black.readthedocs.io/en/stable/), isort, ruff for codestyle. You can run the following command to format your code. It uses Pre-commit hooks to run the formatters and linters.

```bash
make format-code
```

### Docstring convention

This project uses [Google docstring convention](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings).

A full example is available in [here](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html).

## How to release

This project uses [Python Semantic Versioning](https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html)
and [Poetry](https://python-poetry.org/docs/cli/#build) to create releases and tags.

The release process is automated through GitHub Actions. Here is the process:

- Create a Pull Request from `develop` to `main`.
- Merge the Pull Request. This must create a merge commit.
- The merge will trigger the Release GitHub Action defined in [this workflow](.github/workflows/release.yaml).

The Release GitHub Action does the following:

- Checks out the code.
- Runs the CI GitHub Action, which runs the tests and linters.
- Runs Python Semantic Release, which takes care of version update, tag creation, and release creation.

The action is triggered by any push to main.

!!! tip
The release action will be triggered by any push to `main` only if the 'CI' job in the 'release.yaml' workflow succeeds.
Python Semantic Release will take care of version number update, tag creation and release creation.

When it's done, rebase develop to keep it up to date with main.

And you're done ! 🎉
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

54 changes: 33 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
<div align="center">
<h2>
ByteTrack-Pip: Packaged version of the ByteTrack repository
</h2>
# Bytetrack starter guide

This repo is a packaged version of the [ByteTrack](https://github.com/ifzhang/ByteTrack) algorithm.

ByteTrack is a multi-object tracking computer vision model. Using ByteTrack, you can allocate IDs for unique objects in a video for use in tracking objects.

<h4>
<img width="700" alt="teaser" src="assets/demo.gif">
<img width="700" alt="teaser" src="assets/traffic.gif">
</h4>
<div>
<a href="https://pepy.tech/project/bytetracker"><img src="https://pepy.tech/badge/bytetracker" alt="downloads"></a>
<a href="https://badge.fury.io/py/bytetracker"><img src="https://badge.fury.io/py/bytetracker.svg" alt="pypi version"></a>
</div>
</div>

## <div align="center">Overview</div>

This repo is a packaged version of the [ByteTrack](https://github.com/ifzhang/ByteTrack) algorithm.
### Installation

To install the library, run the following command:

```bash
pip install git+https://github.com/artefactory-fr/bytetrack.git@main
```
pip install bytetracker

To install a specific version, run the following command:

```bash
pip install git+https://github.com/artefactory-fr/[email protected]
```

### Detection Model + ByteTrack

```python
from bytetracker import BYTETracker

tracker = BYTETracker(args)
for image in images:
dets = detector(image)
online_targets = tracker.update(dets)
for frame_id, image_filename in enumerate(frames):
img = cv2.imread(image_filename)
detections = your_model.predict(img)
tracked_objects = tracker.update(detections, frame_id)
```
### Reference:
- [Yolov5-Pip](https://github.com/fcakyon/yolov5-pip)
- [ByteTrack](https://github.com/ifzhang/ByteTrack)

## Copyright

Copyright (c) 2022 Kadir Nar

## ByteTrack License

ByteTrack is licensed under the MIT License. See the [LICENSE](LICENSE) file and the [ByteTrack repository](https://github.com/bytedance/ByteTrack) for more information.

### Citation

This is a fork of [bytetrack-pip](https://github.com/kadirnar/bytetrack-pip).

```bibtex
@article{zhang2022bytetrack,
title={ByteTrack: Multi-Object Tracking by Associating Every Detection Box},
Expand Down
Binary file removed assets/demo.gif
Binary file not shown.
Binary file added assets/traffic.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions bytetracker/basetrack.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
from collections import OrderedDict

import numpy as np


class TrackState(object):
New = 0
Tracked = 1
Expand All @@ -17,16 +12,9 @@ class BaseTrack(object):
is_activated = False
state = TrackState.New

history = OrderedDict()
features = []
curr_feature = None
score = 0
start_frame = 0
frame_id = 0
time_since_update = 0

# multi-camera
location = (np.inf, np.inf)

@property
def end_frame(self):
Expand Down
Loading
Loading