Views
No views yet

pip install -U yolov51import yolov5
2
3# load model
4model = yolov5.load('keremberke/yolov5m-csgo')
5
6# set model parameters
7model.conf = 0.25 # NMS confidence threshold
8model.iou = 0.45 # NMS IoU threshold
9model.agnostic = False # NMS class-agnostic
10model.multi_label = False # NMS multiple labels per box
11model.max_det = 1000 # maximum number of detections per image
12
13# set image
14img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
15
16# perform inference
17results = model(img, size=640)
18
19# inference with test time augmentation
20results = model(img, augment=True)
21
22# parse results
23predictions = results.pred[0]
24boxes = predictions[:, :4] # x1, y1, x2, y2
25scores = predictions[:, 4]
26categories = predictions[:, 5]
27
28# show detection bounding boxes on image
29results.show()
30
31# save results into "results/" folder
32results.save(save_dir='results/')yolov5 train --data data.yaml --img 640 --batch 16 --weights keremberke/yolov5m-csgo --epochs 10