• Stars
    star
    150
  • Rank 239,509 (Top 5 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PyTorch implementation of YOLOv5, YOLOv6, YOLOv7, YOLOv8, Sort, StrongSort, OcSort, ByteTrack, Norfair

TorchYolo: YOLO Series Object Detection and Track Algorithm Library

teaser
downloads pypi version HuggingFace Spaces

Introduction

The TorchYolo library aims to support YOLO models(like YOLOv5, YOLOv6, YOLOv7, YOLOv8) and Tracker Algorithm(Sort, StrongSort, ByteTrack, OcSort and Norfair) and provide a unified interface for training and inference. The library is based on PyTorch and is designed to be easy to use and extend.

Installation

pip install torchyolo

Use From Python

First download the default_config.yaml file.

Object Prediction
from torchyolo import YoloHub

model = YoloHub(
    config_path=config_path,
    model_type=model_type,
    model_path=model_path,
)

result = model.predict(source=source)
Object Tracking
model = YoloHub(
    config_path=config_path,
    model_type=model_type,
    model_path=model_path,
)

if tracker_type == "STRONGSORT":
    result = model.tracker_predict(
        source=source,
        tracker_type=tracker_type,
        tracker_weight_path=tracker_weight_path,
        tracker_config_path=tracker_config_path,
    )
else:
    result = model.tracker_predict(
        source=source,
        tracker_type=tracker_type,
        tracker_config_path=tracker_config_path,
    )

Use From Command Line

torchyolo predict --config_path torchyolo/configs/default_config.yaml \
                  --model_type yolov5 \
                  --model_path yolov5s.pt --source test.mp4

torchyolo tracker --config_path torchyolo/configs/default_config.yaml \
                  --model_type yolov5 --model_path yolov5s.pt \
                  --tracker_config_path norfair.yaml

Detect Configuration

DETECTOR_CONFIG:
  # The threshold for the IOU score
  IOU_TH: 0.45
  # The threshold for the confidence score
  CONF_TH: 0.25
  # The size of the image
  IMAGE_SIZE: 640
  # The device to run the detector
  DEVICE: cuda:0
  # F16 precision
  HALF: False
  # The path of the yolov6 label file
  YOLOV6_YAML_FILE: torchyolo/configs/yolov6/coco.yaml
  # The path of the yolovx config file
  YOLOX_CONFIG_PATH: configs.yolox.yolox_s
  # The path of the Hugging Face model
  HUGGING_FACE_MODEL: False 

DATA_CONFIG:
  # The path of the output video
  OUTPUT_PATH: output.mp4
  # Save the video
  SHOW: False 
  # Show the video
  SAVE: True

Tracker Config File

ByteTrack: https://github.com/kadirnar/torchyolo/releases/download/v0.0.5/default_config.yaml

OcSort: https://github.com/kadirnar/torchyolo/releases/download/v0.0.5/oc_sort.yaml

StrongSort: https://github.com/kadirnar/torchyolo/releases/download/v0.0.5/strong_sort.yaml

Norfair: https://github.com/kadirnar/torchyolo/releases/download/v0.0.5/norfair_track.yaml

Sort: https://github.com/kadirnar/torchyolo/releases/download/v0.0.5/sort_track.yaml

Model Architecture

from torchyolo import YoloHub

model = YoloHub(config_path="torchyolo/default_config.yaml")
result = model.view_model(file_format="pdf")

Contributing

Before opening a PR:

  • Install required development packages:
    pip install -e ."[dev]"
  • Reformat the code with black and isort:
    bash script/code_format.sh

Acknowledgement

A part of the code is borrowed from SAHI. Many thanks for their wonderful works.

Citation

@article{wang2022yolov7,
  title={{YOLOv7}: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors},
  author={Wang, Chien-Yao and Bochkovskiy, Alexey and Liao, Hong-Yuan Mark},
  journal={arXiv preprint arXiv:2207.02696},
  year={2022}
}
@article{li2022yolov6,
  title={YOLOv6: A single-stage object detection framework for industrial applications},
  author={Li, Chuyi and Li, Lulu and Jiang, Hongliang and Weng, Kaiheng and Geng, Yifei and Li, Liang and Ke, Zaidan and Li, Qingyuan and Cheng, Meng and Nie, Weiqiang and others},
  journal={arXiv preprint arXiv:2209.02976},
  year={2022}
}
@software{glenn_jocher_2020_4154370,
  author       = {Glenn Jocher and,Alex Stoken and,Jirka Borovec and,NanoCode012 and,ChristopherSTAN and,Liu Changyu and,Laughing and,tkianai and,Adam Hogan and,lorenzomammana and,yxNONG and,AlexWang1900 and,Laurentiu Diaconu and,Marc and,wanghaoyang0106 and,ml5ah and,Doug and,Francisco Ingham and,Frederik and,Guilhen and,Hatovix and,Jake Poznanski and,Jiacong Fang and,Lijun Yu 于力军 and,changyu98 and,Mingyu Wang and,Naman Gupta and,Osama Akhtar and,PetrDvoracek and,Prashant Rai},
  title={{ultralytics/yolov5: v7.2 - Bug Fixes and 
                   Performance Improvements}},
  month= oct,
  year= 2020,
  publisher= {Zenodo},
  version= {v3.1},
  doi= {10.5281/zenodo.4154370},
  url= {https://doi.org/10.5281/zenodo.4154370}
}
@article{cao2022observation,
  title={Observation-Centric SORT: Rethinking SORT for Robust Multi-Object Tracking},
  author={Cao, Jinkun and Weng, Xinshuo and Khirodkar, Rawal and Pang, Jiangmiao and Kitani, Kris},
  journal={arXiv preprint arXiv:2203.14360},
  year={2022}
}
@article{zhang2022bytetrack,
  title={ByteTrack: Multi-Object Tracking by Associating Every Detection Box},
  author={Zhang, Yifu and Sun, Peize and Jiang, Yi and Yu, Dongdong and Weng, Fucheng and Yuan, Zehuan and Luo, Ping and Liu, Wenyu and Wang, Xinggang},
  booktitle={Proceedings of the European Conference on Computer Vision (ECCV)},
  year={2022}
}
@article{du2022strongsort,
  title={Strongsort: Make deepsort great again},
  author={Du, Yunhao and Song, Yang and Yang, Bo and Zhao, Yanyun},
  journal={arXiv preprint arXiv:2202.13514},
  year={2022}
}
@inproceedings{Bewley2016_sort,
  author={Bewley, Alex and Ge, Zongyuan and Ott, Lionel and Ramos, Fabio and Upcroft, Ben},
  booktitle={2016 IEEE International Conference on Image Processing (ICIP)},
  title={Simple online and realtime tracking},
  year={2016},
  pages={3464-3468},
  keywords={Benchmark testing;Complexity theory;Detectors;Kalman filters;Target tracking;Visualization;Computer Vision;Data Association;Detection;Multiple Object Tracking},
  doi={10.1109/ICIP.2016.7533003}
}
@article{torchreid,
    title={Torchreid: A Library for Deep Learning Person Re-Identification in Pytorch},
    author={Zhou, Kaiyang and Xiang, Tao},
    journal={arXiv preprint arXiv:1910.10093},
    year={2019}
} 
@inproceedings{Bewley2016_sort,
  author={Bewley, Alex and Ge, Zongyuan and Ott, Lionel and Ramos, Fabio and Upcroft, Ben},
  booktitle={2016 IEEE International Conference on Image Processing (ICIP)},
  title={Simple online and realtime tracking},
  year={2016},
  pages={3464-3468},
  keywords={Benchmark testing;Complexity theory;Detectors;Kalman filters;Target tracking;Visualization;Computer Vision;Data Association;Detection;Multiple Object Tracking},
  doi={10.1109/ICIP.2016.7533003}
}
@inproceedings{zhou2019osnet,
    title={Omni-Scale Feature Learning for Person Re-Identification},
    author={Zhou, Kaiyang and Yang, Yongxin and Cavallaro, Andrea and Xiang, Tao},
    booktitle={ICCV},
    year={2019}
}
@inproceedings{Bewley2016_sort,
  author={Bewley, Alex and Ge, Zongyuan and Ott, Lionel and Ramos, Fabio and Upcroft, Ben},
  booktitle={2016 IEEE International Conference on Image Processing (ICIP)},
  title={Simple online and realtime tracking},
  year={2016},
  pages={3464-3468},
  keywords={Benchmark testing;Complexity theory;Detectors;Kalman filters;Target tracking;Visualization;Computer Vision;Data Association;Detection;Multiple Object Tracking},
  doi={10.1109/ICIP.2016.7533003}
}
@article{zhou2021osnet,
    title={Learning Generalisable Omni-Scale Representations for Person Re-Identification},
    author={Zhou, Kaiyang and Yang, Yongxin and Cavallaro, Andrea and Xiang, Tao},
    journal={TPAMI},
    year={2021}
}

More Repositories

1

whisper-plus

WhisperPlus: Advancing Speech-to-Text Processing 🚀
Python
1,231
star
2

segment-anything-video

MetaSeg: Packaged version of the Segment Anything repository
Python
892
star
3

yolov5-strongsort

Minimal PyTorch implementation of YOLOv5 and StrongSort
Python
63
star
4

yolov9-pip

This repo is a packaged version of the Yolov9 model.
Python
54
star
5

Yolov7-SAHI

A lightweight vision library for performing large scale object detection & instance segmentation
Python
51
star
6

Stable-Diffusion-ControlNet-WebUI

Diffusion WebUI: Stable Diffusion + ControlNet + Inpaint
Python
47
star
7

Video-Diffusion-WebUI

Video Diffusion WebUI: Text2Video + Image2Video + Video2Video WebUI
Python
42
star
8

yolov5-sahi

Yolov5 Modelini Kullanarak Özel Nesne Eğitimi ve SAHI Kullanımı
35
star
9

bytetrack-pip

Packaged version of the ByteTrack repository
Python
31
star
10

combat-drone

Savaşan İnsansız Hava Aracı için Hedef Takip Sistemi
Python
27
star
11

yolov7-pip

This repo is a packaged version of the Yolov7 model.
Python
23
star
12

codeformer-pip

Towards Robust Blind Face Restoration with Codebook Lookup Transformer
Python
22
star
13

diffusersplus

This project is under development.
Jupyter Notebook
21
star
14

TrackerHub

Real-time Multi-Object Tracking Library
Python
16
star
15

Yolov6-SAHI

Python
14
star
16

bsrgan-pip

BSRGAN-Pip: Packaged version of the BSRGAN repository
Python
13
star
17

losshub

LossHub: Loss Functions Library for Image Classification and Detection
Python
13
star
18

ChatGptHub

ChatGptHub: Gpt Chatbot Library with LangChain Support
Python
13
star
19

sahi-learn

Bu repo SAHI uygulamasını mantığını öğreniyoruz.
Python
12
star
20

ComfyUI-Transformers

Python
12
star
21

yolov4-tiny-face-mask-detection

Yolov4 tiny face mask detection
11
star
22

ocsort-pip

OcSort-Pip: Packaged version of the OcSort repository
Python
10
star
23

Pyorch-LeNet5

PyTorch implementation of LeNet5
Python
9
star
24

dethub

Object Detection Model Library
Python
8
star
25

Generative-AI-Roadmap

8
star
26

kadirnar

7
star
27

strongsort-pip

StrongSort-Pip: Packaged version of StrongSort
Python
6
star
28

wideryolo

WIDERYOLO : Yüz Tespit Uygulaması Yap
Python
6
star
29

Hugging-Face-Projects

My Hugging Face Projects
5
star
30

sort-pip

Sort-Pip: Packaged version of the Sort repository
Python
5
star
31

AnimeSr-Pip

This repo is a packaged version of the AnimeSr Library.
Python
4
star
32

yolov5-format-datasets

Veri Setinizi Yolov5 Formatına Dönüştürün
Python
4
star
33

deep-learning-bootcamp

4
star
34

semantic-segmentation-pytorch

Pytorch Kullanarak Semantik Segmentasyon Uygulaması
Python
4
star
35

yolov6-pip

This repo is a packaged version of the Yolov6 model.
Jupyter Notebook
4
star
36

yolox-pip

Python
3
star
37

Minimal-Yolov6

YOLOv6: Single-stage Object Detection
Python
3
star
38

Norfair-Track

This repo is a packaged version of the Norfair(Tracker Module).
Python
3
star
39

AnimeDiffusion

Python
2
star
40

deepsort-pip

DeepSort-Pip: Packaged version of the DeepSort repository
Python
2
star
41

pytorch-image-classification

Pytorch ile Resim Sınıflandırma
Python
2
star
42

Detectron2

Python
2
star
43

SAHI-Detectron

SAHIDET2: SAHI Kullanarak Yüksek Doğruluklu Nesne Tespit Uygulaması Yap!
Python
2
star
44

comfyui_hub

Python
2
star
45

mlx-diffusion

Python
2
star
46

auto-fast

Python
2
star
47

Stable-Cascade-Demo

Python
2
star
48

sahi-tutorials

SAHI Kütüphanesi için Detaylı Türkçe Dokümantasyonu
2
star
49

Multilingual-Translation

Python
1
star
50

combat-plane

Target Tracking System for Combat Uav
1
star
51

underwater-color-correction

The project is under development.
1
star
52

ardupilot-tutorial

https://ardupilot.org/plane/docs aldığım notlar
1
star
53

hf-llm-inference

1
star
54

uav-datasets

Açık Kaynak İnsansız Hava Aracı Veri Seti
Python
1
star
55

Stable-Diffusion-Outpainting

1
star
56

diffusers-api

Python
1
star
57

classifyhub

Python
1
star
58

yolov4-detection-train

Colab kullanarak yolo modelleri test ve eğitim işlerinin nasıl yapılacağını anlattım.
Jupyter Notebook
1
star
59

python-ile-algoritmalar

Python dilinde Algoritmalar
1
star
60

SkinCancer-Classification

Resnet18 SkinCancer: A Deep Learning Model for Skin Cancer Detection
Python
1
star