msdanellecline commited on
Commit
a872fd6
·
1 Parent(s): d180553

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +74 -1
README.md CHANGED
@@ -1,3 +1,76 @@
 
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
  ---
3
+ tags:
4
+ - yolov5
5
+ - yolo
6
+ - vision
7
+ - object-detection
8
+ - pytorch
9
+ library_name: yolov5
10
+ library_version: 7.0.7
11
+ inference: false
12
+
13
+
14
+ model-index:
15
+ - name: mbari-org/yolov5x-megafish
16
+ results:
17
+ - task:
18
+ type: object-detection
19
+
20
+ metrics:
21
+ - type: precision # since mAP@0.5 is not available on hf.co/metrics
22
+ value: 0.0 # min: 0.0 - max: 1.0
23
+ name: mAP@0.5
24
  ---
25
+
26
+
27
+ ### How to use
28
+
29
+ - Install [yolov5](https://github.com/fcakyon/yolov5-pip):
30
+
31
+ ```bash
32
+ pip install -U yolov5
33
+ ```
34
+
35
+ - Load model and perform prediction:
36
+
37
+ ```python
38
+ import yolov5
39
+
40
+ # load model
41
+ model = yolov5.load('mbari-org/yolov5x-megafish')
42
+
43
+ # set model parameters
44
+ model.conf = 0.25 # NMS confidence threshold
45
+ model.iou = 0.45 # NMS IoU threshold
46
+ model.agnostic = False # NMS class-agnostic
47
+ model.multi_label = False # NMS multiple labels per box
48
+ model.max_det = 1000 # maximum number of detections per image
49
+
50
+ # set image
51
+ img = 'http://dsg.mbari.org/images/dsg/external/Chordata/Osteichthyes/Sebastes_aleutianus-melanostictus_complx_01.png'
52
+
53
+ # perform inference
54
+ results = model(img, size=640)
55
+
56
+ # (optional) inference with test time augmentation
57
+ # results = model(img, augment=True)
58
+
59
+ # parse results
60
+ predictions = results.pred[0]
61
+ boxes = predictions[:, :4] # x1, y1, x2, y2
62
+ scores = predictions[:, 4]
63
+ categories = predictions[:, 5]
64
+
65
+ # show detection bounding boxes on image
66
+ results.show()
67
+
68
+ # save results into "results/" folder
69
+ results.save(save_dir='results/')
70
+ ```
71
+
72
+ - Finetune the model on your custom dataset:
73
+
74
+ ```bash
75
+ yolov5 train --data data.yaml --img 1280 --batch 16 --weights mbari-org/yolov5x-megafish --epochs 10
76
+ ```