Skip to content

Commit ca6ba2e

Browse files
triple-MuChilicyy
authored andcommitted
Format code with pre-commit
1 parent 7609bbf commit ca6ba2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+266
-279
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Implementation of paper - [YOLOv6: A Single-Stage Object Detection Framework for
1414

1515
YOLOv6 has a series of models for various industrial scenarios, including N/T/S/M/L, which the architectures vary considering the model size for better accuracy-speed trade-off. And some Bag-of-freebies methods are introduced to further improve the performance, such as self-distillation and more training epochs. For industrial deployment, we adopt QAT with channel-wise distillation and graph optimization to pursue extreme performance.
1616

17-
YOLOv6-N hits 35.9% AP on COCO dataset with 1234 FPS on T4. YOLOv6-S strikes 43.5% AP with 495 FPS, and the quantized YOLOv6-S model achieves 43.3% AP at a accelerated speed of 869 FPS on T4. YOLOv6-T/M/L also have excellent performance, which show higher accuracy than other detectors with the similar inference speed.
17+
YOLOv6-N hits 35.9% AP on COCO dataset with 1234 FPS on T4. YOLOv6-S strikes 43.5% AP with 495 FPS, and the quantized YOLOv6-S model achieves 43.3% AP at a accelerated speed of 869 FPS on T4. YOLOv6-T/M/L also have excellent performance, which show higher accuracy than other detectors with the similar inference speed.
1818

1919

2020
## What's New
2121

2222
- Release M/L models and update N/T/S models with enhanced performance.⭐️ [Benchmark](#Benchmark)
2323
- 2x faster training time.
24-
- Fix the degration of performance when evaluating on 640x640 inputs.
24+
- Fix the degration of performance when evaluating on 640x640 inputs.
2525
- Customized quantization methods. 🚀 [Quantization Tutorial](./tools/qat/README.md)
2626

2727
## Benchmark
@@ -34,7 +34,7 @@ YOLOv6-N hits 35.9% AP on COCO dataset with 1234 FPS on T4. YOLOv6-S strikes 43.
3434
| [**YOLOv6-L-ReLU**](https://github.com/meituan/YOLOv6/releases/download/0.2.0/yolov6l_relu.pt) | 640 | 51.7 | 113 | 149 | 58.5 | 144.0 |
3535
| [**YOLOv6-L**](https://github.com/meituan/YOLOv6/releases/download/0.2.0/yolov6l.pt) | 640 | 52.5 | 98 | 121 | 58.5 | 144.0 |
3636

37-
### Quantized model 🚀
37+
### Quantized model 🚀
3838

3939
| Model | Size | Precision | mAP<sup>val<br/>0.5:0.95 | Speed<sup>T4<br/>trt b1 <br/>(fps) | Speed<sup>T4<br/>trt b32 <br/>(fps) |
4040
| :-------------------- | ---- | --------- | :----------------------- | ---------------------------------- | ----------------------------------- |
@@ -135,19 +135,19 @@ python -m torch.distributed.launch --nproc_per_node 8 tools/train.py \
135135
--epoch 300 \
136136
--device 0,1,2,3,4,5,6,7 \
137137
--name yolov6m_coco # yolov6l_coco
138-
139-
138+
139+
140140
# Step 2: Self-distillation training
141141
python -m torch.distributed.launch --nproc_per_node 8 tools/train.py \
142-
--batch 256 \ # 128 for distillation of yolov6l
142+
--batch 256 \ # 128 for distillation of yolov6l
143143
--conf configs/yolov6m.py \ # configs/yolov6l.py
144144
--data data/coco.yaml \
145145
--epoch 300 \
146146
--device 0,1,2,3,4,5,6,7 \
147147
--distill \
148148
--teacher_model_path runs/train/yolov6m_coco/weights/best_ckpt.pt \ # # yolov6l_coco
149149
--name yolov6m_coco # yolov6l_coco
150-
150+
151151
```
152152
</details>
153153

@@ -242,5 +242,5 @@ python tools/infer.py --weights yolov6s.pt --source img.jpg / imgdir / video.mp4
242242
* Tutorial: [How to train YOLOv6 on a custom dataset](https://blog.roboflow.com/how-to-train-yolov6-on-a-custom-dataset/) <a href="https://colab.research.google.com/drive/1YnbqOinBZV-c9I7fk_UL6acgnnmkXDMM"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
243243
* Demo of YOLOv6 inference on Google Colab [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mahdilamb/YOLOv6/blob/main/inference.ipynb)
244244
</details>
245-
245+
246246
### [FAQ(Continuously updated)](https://github.com/meituan/YOLOv6/wiki/FAQ%EF%BC%88Continuously-updated%EF%BC%89)

configs/experiment/eval_640_repro.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@
5757
force_no_pad=True,
5858
not_infer_on_rect=True,
5959
)
60-
)
60+
)

configs/experiment/yolov6n_with_eval_params.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
solver = dict(
3232
optim='SGD',
3333
lr_scheduler='Cosine',
34-
lr0=0.02, #0.01 # 0.02
34+
lr0=0.02, #0.01 # 0.02
3535
lrf=0.01,
3636
momentum=0.937,
3737
weight_decay=0.0005,
@@ -55,15 +55,15 @@
5555
)
5656

5757
# Eval params when eval model.
58-
# If eval_params item is list, eg conf_thres=[0.03, 0.03],
58+
# If eval_params item is list, eg conf_thres=[0.03, 0.03],
5959
# first will be used in train.py and second will be used in eval.py.
6060
eval_params = dict(
6161
batch_size=None, #None mean will be the same as batch on one device * 2
6262
img_size=None, #None mean will be the same as train image size
6363
conf_thres=0.03,
6464
iou_thres=0.65,
6565

66-
#pading and scale coord
66+
#pading and scale coord
6767
test_load_size=None, #None mean will be the same as test image size
6868
letterbox_return_int=False,
6969
force_no_pad=False,

configs/experiment/yolov6s_csp_scaled.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
model = dict(
33
type='YOLOv6s_csp',
44
pretrained=None,
5-
depth_multiple=0.70,
5+
depth_multiple=0.70,
66
width_multiple=0.50,
77
backbone=dict(
88
type='CSPBepBackbone',
@@ -39,12 +39,12 @@
3939
weight_decay=0.0005,
4040
warmup_epochs=3.0,
4141
warmup_momentum=0.8,
42-
warmup_bias_lr=0.1
42+
warmup_bias_lr=0.1
4343
)
44-
44+
4545
data_aug = dict(
46-
hsv_h=0.015,
47-
hsv_s=0.7,
46+
hsv_h=0.015,
47+
hsv_s=0.7,
4848
hsv_v=0.4,
4949
degrees=0.0,
5050
translate=0.1,

configs/experiment/yolov6t_csp_scaled.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
model = dict(
33
type='YOLOv6n_csp',
44
pretrained=None,
5-
depth_multiple=0.60,
5+
depth_multiple=0.60,
66
width_multiple=0.50,
77
backbone=dict(
88
type='CSPBepBackbone',
@@ -39,12 +39,12 @@
3939
weight_decay=0.0005,
4040
warmup_epochs=3.0,
4141
warmup_momentum=0.8,
42-
warmup_bias_lr=0.1
42+
warmup_bias_lr=0.1
4343
)
44-
44+
4545
data_aug = dict(
46-
hsv_h=0.015,
47-
hsv_s=0.7,
46+
hsv_h=0.015,
47+
hsv_s=0.7,
4848
hsv_v=0.4,
4949
degrees=0.0,
5050
translate=0.1,

configs/repopt/yolov6_tiny_hs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@
5555
)
5656

5757
# Choose Rep-block by the training Mode, choices=["repvgg", "hyper-search", "repopt"]
58-
training_mode='hyper_search'
58+
training_mode='hyper_search'

configs/repopt/yolov6_tiny_opt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@
5555
mixup=0.0,
5656
)
5757
# Choose Rep-block by the training Mode, choices=["repvgg", "hyper-search", "repopt"]
58-
training_mode='repopt'
58+
training_mode='repopt'

configs/repopt/yolov6n_hs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
solver = dict(
3232
optim='SGD',
3333
lr_scheduler='Cosine',
34-
lr0=0.02, #0.01 # 0.02
34+
lr0=0.02, #0.01 # 0.02
3535
lrf=0.01,
3636
momentum=0.937,
3737
weight_decay=0.0005,
@@ -55,4 +55,4 @@
5555
)
5656

5757
# Choose Rep-block by the training Mode, choices=["repvgg", "hyper-search", "repopt"]
58-
training_mode='hyper_search'
58+
training_mode='hyper_search'

configs/repopt/yolov6n_opt.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
solver = dict(
3333
optim='SGD',
3434
lr_scheduler='Cosine',
35-
lr0=0.02, #0.01 # 0.02
35+
lr0=0.02, #0.01 # 0.02
3636
lrf=0.01,
3737
momentum=0.937,
3838
weight_decay=0.0005,
@@ -55,4 +55,4 @@
5555
mixup=0.0,
5656
)
5757
# Choose Rep-block by the training Mode, choices=["repvgg", "hyper-search", "repopt"]
58-
training_mode='repopt'
58+
training_mode='repopt'

configs/yolov6l.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
model = dict(
33
type='YOLOv6l',
44
pretrained=None,
5-
depth_multiple=1.0,
5+
depth_multiple=1.0,
66
width_multiple=1.0,
77
backbone=dict(
88
type='CSPBepBackbone',
@@ -43,12 +43,12 @@
4343
weight_decay=0.0005,
4444
warmup_epochs=3.0,
4545
warmup_momentum=0.8,
46-
warmup_bias_lr=0.1
46+
warmup_bias_lr=0.1
4747
)
48-
48+
4949
data_aug = dict(
50-
hsv_h=0.015,
51-
hsv_s=0.7,
50+
hsv_h=0.015,
51+
hsv_s=0.7,
5252
hsv_v=0.4,
5353
degrees=0.0,
5454
translate=0.1,
@@ -59,5 +59,5 @@
5959
mosaic=1.0,
6060
mixup=0.1,
6161
)
62-
training_mode = "conv_silu"
63-
# use normal conv to speed up training and further improve accuracy.
62+
training_mode = "conv_silu"
63+
# use normal conv to speed up training and further improve accuracy.

configs/yolov6l_finetune.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
model = dict(
33
type='YOLOv6l',
44
pretrained='weights/yolov6l.pt',
5-
depth_multiple=1.0,
5+
depth_multiple=1.0,
66
width_multiple=1.0,
77
backbone=dict(
88
type='CSPBepBackbone',
@@ -59,5 +59,5 @@
5959
mosaic=1.0,
6060
mixup=0.243,
6161
)
62-
training_mode = "conv_silu"
63-
# use normal conv to speed up training and further improve accuracy.
62+
training_mode = "conv_silu"
63+
# use normal conv to speed up training and further improve accuracy.

configs/yolov6l_relu.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
model = dict(
33
type='YOLOv6l_relu',
44
pretrained=None,
5-
depth_multiple=1.0,
5+
depth_multiple=1.0,
66
width_multiple=1.0,
77
backbone=dict(
88
type='CSPBepBackbone',
@@ -43,12 +43,12 @@
4343
weight_decay=0.0005,
4444
warmup_epochs=3.0,
4545
warmup_momentum=0.8,
46-
warmup_bias_lr=0.1
46+
warmup_bias_lr=0.1
4747
)
48-
48+
4949
data_aug = dict(
50-
hsv_h=0.015,
51-
hsv_s=0.7,
50+
hsv_h=0.015,
51+
hsv_s=0.7,
5252
hsv_v=0.4,
5353
degrees=0.0,
5454
translate=0.1,
@@ -58,4 +58,4 @@
5858
fliplr=0.5,
5959
mosaic=1.0,
6060
mixup=0.1,
61-
)
61+
)

configs/yolov6l_relu_finetune.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
model = dict(
33
type='YOLOv6l_relu',
44
pretrained='weights/yolov6l_relu.pt',
5-
depth_multiple=1.0,
5+
depth_multiple=1.0,
66
width_multiple=1.0,
77
backbone=dict(
88
type='CSPBepBackbone',
@@ -58,4 +58,4 @@
5858
fliplr=0.5,
5959
mosaic=1.0,
6060
mixup=0.243,
61-
)
61+
)

configs/yolov6m.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
model = dict(
33
type='YOLOv6m',
44
pretrained=None,
5-
depth_multiple=0.60,
5+
depth_multiple=0.60,
66
width_multiple=0.75,
77
backbone=dict(
88
type='CSPBepBackbone',
@@ -43,12 +43,12 @@
4343
weight_decay=0.0005,
4444
warmup_epochs=3.0,
4545
warmup_momentum=0.8,
46-
warmup_bias_lr=0.1
46+
warmup_bias_lr=0.1
4747
)
48-
48+
4949
data_aug = dict(
50-
hsv_h=0.015,
51-
hsv_s=0.7,
50+
hsv_h=0.015,
51+
hsv_s=0.7,
5252
hsv_v=0.4,
5353
degrees=0.0,
5454
translate=0.1,
@@ -58,4 +58,4 @@
5858
fliplr=0.5,
5959
mosaic=1.0,
6060
mixup=0.1,
61-
)
61+
)

configs/yolov6m_finetune.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
model = dict(
33
type='YOLOv6m',
44
pretrained='weights/yolov6m.pt',
5-
depth_multiple=0.60,
5+
depth_multiple=0.60,
66
width_multiple=0.75,
77
backbone=dict(
88
type='CSPBepBackbone',
@@ -58,4 +58,4 @@
5858
fliplr=0.5,
5959
mosaic=1.0,
6060
mixup=0.243,
61-
)
61+
)

configs/yolov6n.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
solver = dict(
3232
optim='SGD',
3333
lr_scheduler='Cosine',
34-
lr0=0.02, #0.01 # 0.02
34+
lr0=0.02, #0.01 # 0.02
3535
lrf=0.01,
3636
momentum=0.937,
3737
weight_decay=0.0005,

deploy/ONNX/OpenCV/yolo.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626
def draw_label(input_image, label, left, top):
2727
"""Draw text onto image at location."""
28-
28+
2929
# Get text size.
3030
text_size = cv2.getTextSize(label, FONT_FACE, FONT_SCALE, THICKNESS)
3131
dim, baseline = text_size[0], text_size[1]
32-
# Use text size to create a BLACK rectangle.
32+
# Use text size to create a BLACK rectangle.
3333
cv2.rectangle(input_image, (left, top), (left + dim[0], top + dim[1] + baseline), BLACK, cv2.FILLED)
3434
# Display text inside the rectangle.
3535
cv2.putText(input_image, label, (left, top + dim[1]), FONT_FACE, FONT_SCALE, YELLOW, THICKNESS, cv2.LINE_AA)
@@ -88,7 +88,7 @@ def post_process(input_image, outputs):
8888
top = int((cy - h/2) * y_factor)
8989
width = int(w * x_factor)
9090
height = int(h * y_factor)
91-
91+
9292
box = np.array([left, top, width, height])
9393
boxes.append(box)
9494

@@ -129,7 +129,7 @@ def post_process(input_image, outputs):
129129
# Give the weight files to the model and load the network using them.
130130
net = cv2.dnn.readNet(model_path)
131131

132-
# Put efficiency information. The function getPerfProfile returns the overall time for inference(t) and the
132+
# Put efficiency information. The function getPerfProfile returns the overall time for inference(t) and the
133133
# timings for each of the layers(in layersTimes)
134134
# Process image.
135135
cycles = 300
@@ -140,10 +140,10 @@ def post_process(input_image, outputs):
140140
t, _ = net.getPerfProfile()
141141
total_time += t
142142
print(f'Cycle [{i + 1}]:\t{t * 1000.0 / cv2.getTickFrequency():.2f}\tms')
143-
143+
144144
avg_time = total_time / cycles
145145
label = 'Average Inference time: %.2f ms' % (avg_time * 1000.0 / cv2.getTickFrequency())
146146
print(f'Model: {window_name}\n{label}')
147147
cv2.putText(img, label, (20, 40), FONT_FACE, FONT_SCALE, RED, THICKNESS, cv2.LINE_AA)
148148
cv2.imshow(window_name, img)
149-
cv2.waitKey(0)
149+
cv2.waitKey(0)

0 commit comments

Comments
 (0)