keremberke commited on
Commit
0324717
1 Parent(s): 02594e9

Add yolov5 model card

Browse files
Files changed (1) hide show
  1. README.md +87 -0
README.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+ tags:
4
+ - yolov5
5
+ - yolo
6
+ - vision
7
+ - object-detection
8
+ - pytorch
9
+ library_name: yolov5
10
+ library_version: 7.0.6
11
+ inference: false
12
+
13
+ datasets:
14
+ - keremberke/csgo-object-detection
15
+
16
+ model-index:
17
+ - name: keremberke/yolov5s-csgo
18
+ results:
19
+ - task:
20
+ type: object-detection
21
+
22
+ dataset:
23
+ type: keremberke/csgo-object-detection
24
+ name: keremberke/csgo-object-detection
25
+ split: validation
26
+
27
+ metrics:
28
+ - type: precision # since [email protected] is not available on hf.co/metrics
29
+ value: 0.9244741806408356 # min: 0.0 - max: 1.0
30
31
+ ---
32
+
33
+ <div align="center">
34
+ <img width="640" alt="keremberke/yolov5s-csgo" src="https://huggingface.co/keremberke/yolov5s-csgo/resolve/main/sample_visuals.jpg">
35
+ </div>
36
+
37
+ ### How to use
38
+
39
+ - Install [yolov5](https://github.com/fcakyon/yolov5-pip):
40
+
41
+ ```bash
42
+ pip install -U yolov5
43
+ ```
44
+
45
+ - Load model and perform prediction:
46
+
47
+ ```python
48
+ import yolov5
49
+
50
+ # load model
51
+ model = yolov5.load('keremberke/yolov5s-csgo')
52
+
53
+ # set model parameters
54
+ model.conf = 0.25 # NMS confidence threshold
55
+ model.iou = 0.45 # NMS IoU threshold
56
+ model.agnostic = False # NMS class-agnostic
57
+ model.multi_label = False # NMS multiple labels per box
58
+ model.max_det = 1000 # maximum number of detections per image
59
+
60
+ # set image
61
+ img = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
62
+
63
+ # perform inference
64
+ results = model(img, size=640)
65
+
66
+ # inference with test time augmentation
67
+ results = model(img, augment=True)
68
+
69
+ # parse results
70
+ predictions = results.pred[0]
71
+ boxes = predictions[:, :4] # x1, y1, x2, y2
72
+ scores = predictions[:, 4]
73
+ categories = predictions[:, 5]
74
+
75
+ # show detection bounding boxes on image
76
+ results.show()
77
+
78
+ # save results into "results/" folder
79
+ results.save(save_dir='results/')
80
+ ```
81
+
82
+ - Finetune the model on your custom dataset:
83
+
84
+ ```bash
85
+ yolov5 train --data data.yaml --img 640 --batch 16 --weights keremberke/yolov5s-csgo --epochs 10
86
+ ```
87
+