File size: 1,536 Bytes
a7132bc
 
23120e9
 
 
 
 
 
 
a7132bc
23120e9
a03ee65
 
 
 
 
 
 
 
23120e9
 
 
 
 
 
 
 
 
 
a21dec2
23120e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fe6ab43
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
license: gpl-3.0
tags:
  - object-detection
  - computer-vision
  - yolov7
  - pypi
datasets:
  - detection-datasets/coco
---

### Model Description
[YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors](https://arxiv.org/abs/2207.02696)

[YOLOv7-Pip: Packaged version of the Yolov7 repository](https://github.com/kadirnar/yolov7-pip)

[Paper Repo: Implementation of paper - YOLOv7](https://github.com/WongKinYiu/yolov7)


### Installation
```
pip install yolov7detect
```

### Yolov7 Inference
```python
import yolov7

# load pretrained or custom model
model = yolov7.load('kadirnar/yolov7-tiny-v0.1', hf_model=True)

# set model parameters
model.conf = 0.25  # NMS confidence threshold
model.iou = 0.45  # NMS IoU threshold
model.classes = None  # (optional list) filter by class

# set image
imgs = 'inference/images'

# perform inference
results = model(imgs)

# inference with larger input size and test time augmentation
results = model(img, size=1280, augment=True)

# parse results
predictions = results.pred[0]
boxes = predictions[:, :4] # x1, y1, x2, y2
scores = predictions[:, 4]
categories = predictions[:, 5]

# show detection bounding boxes on image
results.show()
```

### BibTeX Entry and Citation Info
 ```
@article{wang2022yolov7,
  title={{YOLOv7}: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors},
  author={Wang, Chien-Yao and Bochkovskiy, Alexey and Liao, Hong-Yuan Mark},
  journal={arXiv preprint arXiv:2207.02696},
  year={2022}
}
```