Skip to content

Commit 124eb18

Browse files
committed
update readme and yolov6lite init
1 parent 001d34c commit 124eb18

File tree

6 files changed

+24
-18
lines changed

6 files changed

+24
-18
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This project aims to:
2626

2727
**RECENT UPDATED**
2828

29+
- 2023-05-31 fix issue #1 yolov6 infer update
2930
- 2023-05-26 Migration model inference part: rt-detr(RT-DETR-R50-m,RT-DETR-R34,RT-DETR-R18)
3031
- 2023-04-25 Migration model inference part: rt-detr(DETRs Beat YOLOs on Real-time Object Detection)
3132
- 2023-02-13 Migration model inference part: retinanet

README_cn.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
**近期更新**
2828

29+
- 2023-05-31 修复问题issue #1 yolov6 推理部分
2930
- 2023-05-26 迁移模型推理部分: rt-detr(RT-DETR-R50-m,RT-DETR-R34,RT-DETR-R18)
3031
- 2023-04-25 迁移模型推理部分: rt-detr(DETRs Beat YOLOs on Real-time Object Detection)
3132
- 2023-02-03 迁移模型推理部分:retinanet

README_en.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This project aims to:
2323

2424
**RECENT UPDATED**
2525

26+
- 2023-05-31 fix issue #1 yolov6 infer update
2627
- 2023-05-26 Migration model inference part: rt-detr(RT-DETR-R50-m,RT-DETR-R34,RT-DETR-R18)
2728
- 2023-04-25 Migration model inference part: rt-detr(DETRs Beat YOLOs on Real-time Object Detection)
2829
- 2023-02-13 Migration model inference part: retinanet

ppdettorch/modeling/backbones/yolov6_efficientrep.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,11 @@
2626
__all__ = ['EfficientRep', 'CSPBepBackbone', 'Lite_EffiBackbone']
2727

2828

29-
def get_activation(name="silu"):
30-
if name == "silu":
31-
module = nn.SiLU()
32-
elif name == "relu":
33-
module = nn.ReLU()
34-
elif name in ["LeakyReLU", 'leakyrelu', 'lrelu']:
35-
module = nn.LeakyReLU(0.1)
36-
else:
37-
raise AttributeError("Unsupported act type: {}".format(name))
38-
return module
39-
29+
activation_table = {
30+
'relu': nn.ReLU(),
31+
'silu': nn.SiLU(),
32+
'hardswish': nn.Hardswish()
33+
}
4034

4135
class SiLU(nn.Module):
4236
def __init__(self):
@@ -65,7 +59,10 @@ def __init__(self,
6559
groups=groups,
6660
bias=bias)
6761
self.bn = nn.BatchNorm2d(out_channels)
68-
self.act = get_activation(act) # silu
62+
if act is not None:
63+
self.act = activation_table.get(act)
64+
else:
65+
self.act = nn.Identity()
6966

7067
def forward(self, x):
7168
x = self.bn(self.conv(x))
@@ -1043,7 +1040,7 @@ def build_block(num_repeat, in_channels, mid_channels, out_channels):
10431040
mid_channels=mid_channels,
10441041
out_channels=out_channels,
10451042
stride=1)
1046-
block_list.add_sublayer(str(i), block)
1043+
block_list.add_module(str(i), block)
10471044
return block_list
10481045

10491046
@property

ppdettorch/modeling/heads/yolov6_head.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,10 +1058,10 @@ def __init__(
10581058
self.proj_conv = nn.Conv2d(self.reg_max + 1, 1, 1, bias=False)
10591059
self.proj_conv.skip_quant = True
10601060

1061-
self.proj = torch.linspace(0, self.reg_max, self.reg_max + 1)
1062-
self.proj_conv.weight.set_value(
1063-
self.proj.reshape([1, self.reg_max + 1, 1, 1]))
1064-
self.proj_conv.weight.stop_gradient = True
1061+
# self.proj = torch.linspace(0, self.reg_max, self.reg_max + 1)
1062+
# self.proj_conv.weight.set_value(
1063+
# self.proj.reshape([1, self.reg_max + 1, 1, 1]))
1064+
# self.proj_conv.weight.stop_gradient = True
10651065
self.print_l1_loss = print_l1_loss
10661066
self._initialize_biases()
10671067

tests/process/infer/run_detection_infer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,15 @@ def run_picodet_coco(self, config_name=None):
160160
# config_name = "ppyoloe_convnext_tiny_36e_coco.yml"
161161

162162
# # yolov6
163-
config_name = "yolov6_n_300e_coco.yml"
163+
# config_name = "yolov6_n_300e_coco.yml"
164164
# config_name = "yolov6_s_300e_coco.yml"
165165
# config_name = "yolov6_m_300e_coco.yml"
166166
config_name = "yolov6_l_300e_coco.yml"
167167

168+
# config_name = "yolov6lite/yolov6lite_s_400e_coco.yml"
169+
# config_name = "yolov6lite/yolov6lite_m_400e_coco.yml"
170+
# config_name = "yolov6lite/yolov6lite_l_400e_coco.yml"
171+
168172
# # yolov7
169173
# config_name = "yolov7_l_300e_coco.yml"
170174
#
@@ -215,6 +219,8 @@ def run_picodet_coco(self, config_name=None):
215219
model_class = "ssd"
216220
elif "blazeface_" in config_name:
217221
model_class = "face_detection"
222+
elif "yolov6lite_" in config_name:
223+
model_class = "yolov6"
218224
else:
219225
config_name_end_index = FileUtils.get_file_name(config_name).find("_")
220226
model_class = config_name[:config_name_end_index]

0 commit comments

Comments
 (0)