Skip to content

sonjuhy/VisionicAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VisionicAI

Language PyTorch ONNX

VisionicAI는 YOLO11 Nano를 대체하기 위해 설계된 초경량, 고성능 객체 탐지(Object Detection) 오픈소스 모델인 **VisionicModel**을 제공하는 프로젝트입니다. 모바일 기기와 NPU(Neural Processing Unit) 배포에 최적화된 아키텍처를 자랑합니다.

✨ 주요 특징 (Key Features)

  • 초경량 & 고성능: YOLOv8n / YOLO11n과 비슷한 파라미터(약 2.9M)를 가지면서도 NPU 및 Edge 디바이스 친화적인 연산을 통해 더 나은 효율과 정확도를 목표로 합니다.
  • NPU 친화적 구조 (Reparameterization):
    • 훈련 시에는 다중 브랜치(Multi-branch)를 사용하여 풍부한 그래디언트를 얻고, 추론 시에는 fuse() 메서드를 통해 단일 연산(Single OP)으로 변환되어 극강의 속도를 자랑합니다.
    • 하드웨어 가속기에서 비효율적인 연산을 최대한 배제하고 PWConv와 구조화된 DWConv만을 주로 사용합니다.
  • 최신 기법 통합:
    • Distribution Focal Loss (DFL, reg_max=16) 적용
    • YOLOX 스타일의 Decoupled Head와 PAFPN Neck 결합
  • ONNX 및 Edge 변환 지원: 단 한 줄의 명령어로 분리된 데이터 없는 깔끔한 ONNX 모델 생성이 가능합니다.

💻 설치 방법 (Installation)

# 저장소 클론
git clone https://github.com/edint-Hub/VisionicAI.git
cd VisionicAI

# 의존성 설치 (필요시 가상환경 생성 권장)
pip install torch torchvision
pip install -r requirements.txt # (필요한 패키지가 있을 경우)

🚀 빠른 시작 (Quick Start)

1. 추론 (Inference)

제공된 visionic_nano.pt 가중치를 이용해 이미지에서 객체를 탐지할 수 있습니다.

python infer.py --weights weight/visionic_nano.pt --source test_image.jpg --conf_thres 0.25

결과 이미지는 기본적으로 runs/detect/ 폴더에 바운딩 박스가 그려진 상태로 저장됩니다.

2. ONNX 모델 내보내기 (Export to ONNX)

NPU/모바일 배포를 위해 모델을 ONNX 형식으로 내보냅니다. (자동으로 fuse()onnxsim 최적화가 진행되며 단일 파일로 병합됩니다.)

python tools/trans_to_onnx.py --weights weight/visionic_nano.pt --save_path weight/visionic_nano.onnx

3. 파인튜닝 (Fine-Tuning)

사전 학습된 가중치를 로드하고 커스텀 데이터셋(COCO 포맷 권장)에 맞춰 파인튜닝을 진행합니다.

# 백본 가중치를 동결(Freeze)하고 빠르게 파인튜닝
python tools/finetune.py --weights weight/visionic_nano.pt --freeze_backbone --data_root /path/to/dataset --epochs 50

# 전체 레이어 학습
python tools/finetune.py --weights weight/visionic_nano.pt --data_root /path/to/dataset --epochs 300

4. 모델 벤치마크 (ONNX Benchmark)

YOLOv8n 등 타 모델과 추론 지연시간(Latency)을 비교 측정합니다.

python tools/model_benchmark_onnx.py



VisionicAI (English Version)

VisionicAI is an open-source project providing VisionicModel, an ultra-lightweight, high-performance object detection model designed to serve as an alternative to YOLO11 Nano. It boasts an architecture highly optimized for deployment on mobile devices and NPUs (Neural Processing Units).

✨ Key Features

  • Ultra-lightweight & High Performance: Designed with parameters similar to YOLOv8n / YOLO11n (~2.9M), aiming for better efficiency and accuracy through NPU and Edge device-friendly computations.
  • NPU-Friendly Architecture (Reparameterization):
    • Utilizes multi-branch structural designs during training for richer gradients. During inference, it uses the fuse() method to collapse into a single operation (Single OP), ensuring lightning-fast speed.
    • Minimizes inefficient operations on hardware accelerators, heavily relying on PWConv and structured DWConv.
  • Integration of State-of-the-Art Techniques:
    • Application of Distribution Focal Loss (DFL, reg_max=16).
    • Combination of YOLOX-style Decoupled Head and PAFPN Neck.
  • ONNX and Edge Deployment Support: Generate a clean, single-file ONNX model without detached .data files with just one command.

💻 Installation

# Clone the repository
git clone https://github.com/edint-Hub/VisionicAI.git
cd VisionicAI

# Install dependencies (Virtual environment recommended)
pip install torch torchvision
pip install -r requirements.txt # (If available)

🚀 Quick Start

1. Inference

Detect objects in an image using the provided visionic_nano.pt weights.

python infer.py --weights weight/visionic_nano.pt --source test_image.jpg --conf_thres 0.25

The resulting image with bounding boxes drawn will be saved in the runs/detect/ folder by default.

2. Export to ONNX

Export the model to ONNX format for NPU/Mobile deployment. (It automatically performs fuse(), onnxsim optimization, and merges into a single file.)

python tools/trans_to_onnx.py --weights weight/visionic_nano.pt --save_path weight/visionic_nano.onnx

3. Fine-Tuning

Load pre-trained weights and fine-tune the model on your custom dataset (COCO format recommended).

# Fast fine-tuning by freezing the backbone weights
python tools/finetune.py --weights weight/visionic_nano.pt --freeze_backbone --data_root /path/to/dataset --epochs 50

# Train all layers
python tools/finetune.py --weights weight/visionic_nano.pt --data_root /path/to/dataset --epochs 300

4. Model Benchmark (ONNX Benchmark)

Measure and compare the inference latency against other models like YOLOv8n.

python tools/model_benchmark_onnx.py

📜 License

This project is open-source and available under the Apache License 2.0.

About

VisionicAI: Ultra-lightweight object detection model optimized for NPU. 1인 주도로 아키텍처 설계 및 학습 파이프라인 전 과정 개발.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages