Skip to content

NK-JittorCV/nk-yolo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NK_YOLO

Python Jittor License Platform

closed issue open issues

NK-YOLO is a comprehensive object detection benchmark built on Jittor, providing state-of-the-art YOLO implementations with automatic compilation and optimized performance.

πŸ“– Documentation | πŸš€ Quick Start | 🎯 Models | πŸ“Š Results


✨ Features

  • πŸ”₯ Automatic Compilation: No manual CUDA/C++ compilation required
  • πŸš€ Multi-Model Support: YOLOv5, YOLOv6, YOLOv7, YOLOv8, YOLOv10, YOLO-MS
  • ⚑ High Performance: Optimized for speed and accuracy
  • 🎯 Easy Training: Simple training pipeline with comprehensive configuration
  • πŸ“Š Rich Evaluation: Built-in validation and testing tools
  • πŸ› οΈ Cross-Platform: Support for Linux, macOS, and WSL

🎯 Supported Models

Model Paper Repository Status
YOLOv5 Paper ultralytics/yolov5 βœ…
YOLOv6 Paper meituan/YOLOv6 βœ…
YOLOv7 Paper WongKinYiu/yolov7 βœ…
YOLOv8 Paper ultralytics/ultralytics βœ…
YOLOv10 Paper THU-MIG/yolov10 βœ…
YOLO-MS ⭐ Paper FishAndWasabi/YOLO-MS βœ…

πŸ› οΈ Installation

System Requirements

  • OS: Linux (Ubuntu/CentOS/Arch), macOS, or Windows Subsystem for Linux (WSL)
  • Python: >= 3.7
  • CPU Compiler: g++ (>=5.4.0) or clang (>=8.0)
  • GPU Compiler (Optional): nvcc (>=10.0 for g++ or >=10.2 for clang)
  • GPU Library: cudnn-dev (recommended tar file installation)

Step 1: Clone and Install Dependencies

git clone https://github.com/NK-JittorCV/nk-yolo.git
cd nk-yolo
python -m pip install -r requirements.txt

πŸ’‘ Note: If you encounter Jittor installation issues, please refer to the Jittor Installation Guide.

Step 2: Install NK-YOLO

# Option 1: Install in development mode
pip install -v -e .

# Option 2: Install with user permissions (if needed)
pip install -v -e . --user

πŸš€ Getting Started

Quick Demo

python demo.py

This will:

  1. Train a YOLOv8 model on COCO8 dataset for 2 epochs
  2. Evaluate the model performance
  3. Run inference on sample images

Basic Usage

from nkyolo import YOLO

# Load a model
model = YOLO('yolov8n.yaml')

# Train the model
results = model.train(
    data='coco8.yaml',
    epochs=100,
    imgsz=640,
    batch=16,
    device='cpu'  # or '0' for GPU
)

# Validate the model
metrics = model.val()

# Run inference
results = model('path/to/image.jpg')
results[0].show()

🎯 Training

1. Prepare Your Dataset

Create a YAML configuration file for your dataset:

# dataset.yaml
path: ../datasets/coco  # dataset root directory
train: images/train2017  # train images (relative to 'path')
val: images/val2017      # val images (relative to 'path')

# Classes
names:
  0: person
  1: bicycle
  2: car
  # ... more classes

2. Training Commands

Basic Training

python -m nkyolo.models.yolo.detect.train \
    --model yolov8n.yaml \
    --data coco.yaml \
    --epochs 100 \
    --imgsz 640 \
    --batch 16 \
    --device cpu

Advanced Training Options

python -m nkyolo.models.yolo.detect.train \
    --model yolov8n.yaml \
    --data coco.yaml \
    --epochs 100 \
    --imgsz 640 \
    --batch 16 \
    --device 0 \
    --workers 8 \
    --patience 50 \
    --save-period 10 \
    --cache ram

3. Training Parameters

Parameter Description Default
--model Model configuration file yolov8n.yaml
--data Dataset configuration file coco.yaml
--epochs Number of training epochs 100
--imgsz Input image size 640
--batch Batch size 16
--device Device to run on (cpu/0/0,1,2,3) cpu
--workers Number of worker threads 8
--patience Early stopping patience 50
--save-period Save checkpoint every N epochs -1
--cache Cache images (ram/disk) False

4. Training with Different Models

# YOLOv8
python -m nkyolo.models.yolo.detect.train --model yolov8n.yaml

πŸ§ͺ Testing & Evaluation

1. Model Validation

# Validate a trained model
python -m nkyolo.models.yolo.detect.train \
    --model ${CKPT_PATH} \
    --data coco.yaml \
    --task val

2. Inference

from nkyolo import YOLO

# Load trained model
model = YOLO(${CKPT_PATH})

# Single image inference
results = model('path/to/image.jpg')
results[0].show()
results[0].save('output.jpg')

# Batch inference
results = model(['image1.jpg', 'image2.jpg', 'image3.jpg'])

# Video inference
results = model('video.mp4')

3. Performance Evaluation

# Evaluate model performance
python -m nkyolo.models.yolo.detect.train \
    --model runs/train/exp/weights/best.pt \
    --data coco.yaml \
    --task val \
    --conf 0.001 \
    --iou 0.6

πŸ“Š Model Performance

YOLOv10 Models

Model Test Size #Params FLOPs APval Latency
YOLOv10-N 640 2.3M 6.7G 38.5% 1.84ms
YOLOv10-S 640 7.2M 21.6G 46.3% 2.49ms
YOLOv10-M 640 15.4M 59.1G 51.1% 4.74ms
YOLOv10-B 640 19.1M 92.0G 52.5% 5.74ms
YOLOv10-L 640 24.4M 120.3G 53.2% 7.28ms
YOLOv10-X 640 29.5M 160.4G 54.4% 10.70ms

πŸ“ Project Structure

nk-yolo/
β”œβ”€β”€ nkyolo/           # Main package
β”‚   β”œβ”€β”€ cfg/             # Configuration files
β”‚   β”‚   β”œβ”€β”€ datasets/    # Dataset configurations
β”‚   β”‚   └── models/      # Model configurations
β”‚   β”œβ”€β”€ data/            # Data loading and processing
β”‚   β”œβ”€β”€ engine/          # Training engine
β”‚   β”œβ”€β”€ models/          # Model implementations
β”‚   β”œβ”€β”€ nn/              # Neural network modules
β”‚   └── utils/           # Utility functions
β”œβ”€β”€ datasets/            # Dataset storage
β”œβ”€β”€ runs/               # Training outputs
β”œβ”€β”€ demo.py             # Demo script
└── requirements.txt    # Dependencies

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

πŸ“„ License

This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.

πŸ™ Acknowledgments

This project is built on top of these excellent open-source projects:

πŸ“š Citation

If you find this work useful for your research, please cite:

@article{hu2020jittor,
  title={Jittor: a novel deep learning framework with meta-operators and unified graph execution},
  author={Hu, Shi-Min and Liang, Dun and Yang, Guo-Ye and Yang, Guo-Wei and Zhou, Wen-Yang},
  journal={Science China Information Sciences},
  volume={63},
  number={222103},
  pages={1--21},
  year={2020}
}

@article{Chen2025,
  title = {YOLO-MS: Rethinking Multi-Scale Representation Learning for Real-time Object Detection},
  ISSN = {1939-3539},
  url = {http://dx.doi.org/10.1109/TPAMI.2025.3538473},
  DOI = {10.1109/tpami.2025.3538473},
  journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
  publisher = {Institute of Electrical and Electronics Engineers (IEEE)},
  author = {Chen, Yuming and Yuan, Xinbin and Wang, Jiabao and Wu, Ruiqi and Li, Xiang and Hou, Qibin and Cheng, Ming-Ming},
  year = {2025},
  pages = {1–14}
}

@article{wang2024yolov10,
  title={YOLOv10: Real-Time End-to-End Object Detection},
  author={Wang, Ao and Chen, Hui and Liu, Lihao and Chen, Kai and Lin, Zijia and Han, Jungong and Ding, Guiguang},
  journal={arXiv preprint arXiv:2405.14458},
  year={2024}
}

Made with ❀️ by the NK-YOLO Team

⭐ Star this repo | πŸ› Report Issues | πŸ“– Documentation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5