Views
No views yet
pip install yolov9pip1import yolov9
2
3# load pretrained or custom model
4model = yolov7.load('kadirnar/yolov9-gelan-c')
5
6# set model parameters
7model.conf = 0.25 # NMS confidence threshold
8model.iou = 0.45 # NMS IoU threshold
9model.classes = None # (optional list) filter by class
10
11# set image
12imgs = 'inference/images'
13
14# perform inference
15results = model(imgs)
16
17# inference with larger input size and test time augmentation
18results = model(img, size=640, augment=True)
19
20# parse results
21predictions = results.pred[0]
22boxes = predictions[:, :4] # x1, y1, x2, y2
23scores = predictions[:, 4]
24categories = predictions[:, 5]
25
26# show detection bounding boxes on image
27results.show()@article{wang2024yolov9,
title={{YOLOv9}: Learning What You Want to Learn Using Programmable Gradient Information},
author={Wang, Chien-Yao and Liao, Hong-Yuan Mark},
booktitle={arXiv preprint arXiv:2402.13616},
year={2024}
}