bplusplus 1.1.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bplusplus might be problematic. Click here for more details.
- bplusplus/__init__.py +4 -2
- bplusplus/collect.py +72 -3
- bplusplus/hierarchical/test.py +670 -0
- bplusplus/hierarchical/train.py +676 -0
- bplusplus/prepare.py +236 -71
- bplusplus/resnet/test.py +473 -0
- bplusplus/resnet/train.py +329 -0
- bplusplus-1.2.1.dist-info/METADATA +252 -0
- bplusplus-1.2.1.dist-info/RECORD +12 -0
- bplusplus/yolov5detect/__init__.py +0 -1
- bplusplus/yolov5detect/detect.py +0 -444
- bplusplus/yolov5detect/export.py +0 -1530
- bplusplus/yolov5detect/insect.yaml +0 -8
- bplusplus/yolov5detect/models/__init__.py +0 -0
- bplusplus/yolov5detect/models/common.py +0 -1109
- bplusplus/yolov5detect/models/experimental.py +0 -130
- bplusplus/yolov5detect/models/hub/anchors.yaml +0 -56
- bplusplus/yolov5detect/models/hub/yolov3-spp.yaml +0 -52
- bplusplus/yolov5detect/models/hub/yolov3-tiny.yaml +0 -42
- bplusplus/yolov5detect/models/hub/yolov3.yaml +0 -52
- bplusplus/yolov5detect/models/hub/yolov5-bifpn.yaml +0 -49
- bplusplus/yolov5detect/models/hub/yolov5-fpn.yaml +0 -43
- bplusplus/yolov5detect/models/hub/yolov5-p2.yaml +0 -55
- bplusplus/yolov5detect/models/hub/yolov5-p34.yaml +0 -42
- bplusplus/yolov5detect/models/hub/yolov5-p6.yaml +0 -57
- bplusplus/yolov5detect/models/hub/yolov5-p7.yaml +0 -68
- bplusplus/yolov5detect/models/hub/yolov5-panet.yaml +0 -49
- bplusplus/yolov5detect/models/hub/yolov5l6.yaml +0 -61
- bplusplus/yolov5detect/models/hub/yolov5m6.yaml +0 -61
- bplusplus/yolov5detect/models/hub/yolov5n6.yaml +0 -61
- bplusplus/yolov5detect/models/hub/yolov5s-LeakyReLU.yaml +0 -50
- bplusplus/yolov5detect/models/hub/yolov5s-ghost.yaml +0 -49
- bplusplus/yolov5detect/models/hub/yolov5s-transformer.yaml +0 -49
- bplusplus/yolov5detect/models/hub/yolov5s6.yaml +0 -61
- bplusplus/yolov5detect/models/hub/yolov5x6.yaml +0 -61
- bplusplus/yolov5detect/models/segment/yolov5l-seg.yaml +0 -49
- bplusplus/yolov5detect/models/segment/yolov5m-seg.yaml +0 -49
- bplusplus/yolov5detect/models/segment/yolov5n-seg.yaml +0 -49
- bplusplus/yolov5detect/models/segment/yolov5s-seg.yaml +0 -49
- bplusplus/yolov5detect/models/segment/yolov5x-seg.yaml +0 -49
- bplusplus/yolov5detect/models/tf.py +0 -797
- bplusplus/yolov5detect/models/yolo.py +0 -495
- bplusplus/yolov5detect/models/yolov5l.yaml +0 -49
- bplusplus/yolov5detect/models/yolov5m.yaml +0 -49
- bplusplus/yolov5detect/models/yolov5n.yaml +0 -49
- bplusplus/yolov5detect/models/yolov5s.yaml +0 -49
- bplusplus/yolov5detect/models/yolov5x.yaml +0 -49
- bplusplus/yolov5detect/utils/__init__.py +0 -97
- bplusplus/yolov5detect/utils/activations.py +0 -134
- bplusplus/yolov5detect/utils/augmentations.py +0 -448
- bplusplus/yolov5detect/utils/autoanchor.py +0 -175
- bplusplus/yolov5detect/utils/autobatch.py +0 -70
- bplusplus/yolov5detect/utils/aws/__init__.py +0 -0
- bplusplus/yolov5detect/utils/aws/mime.sh +0 -26
- bplusplus/yolov5detect/utils/aws/resume.py +0 -41
- bplusplus/yolov5detect/utils/aws/userdata.sh +0 -27
- bplusplus/yolov5detect/utils/callbacks.py +0 -72
- bplusplus/yolov5detect/utils/dataloaders.py +0 -1385
- bplusplus/yolov5detect/utils/docker/Dockerfile +0 -73
- bplusplus/yolov5detect/utils/docker/Dockerfile-arm64 +0 -40
- bplusplus/yolov5detect/utils/docker/Dockerfile-cpu +0 -42
- bplusplus/yolov5detect/utils/downloads.py +0 -136
- bplusplus/yolov5detect/utils/flask_rest_api/README.md +0 -70
- bplusplus/yolov5detect/utils/flask_rest_api/example_request.py +0 -17
- bplusplus/yolov5detect/utils/flask_rest_api/restapi.py +0 -49
- bplusplus/yolov5detect/utils/general.py +0 -1294
- bplusplus/yolov5detect/utils/google_app_engine/Dockerfile +0 -25
- bplusplus/yolov5detect/utils/google_app_engine/additional_requirements.txt +0 -6
- bplusplus/yolov5detect/utils/google_app_engine/app.yaml +0 -16
- bplusplus/yolov5detect/utils/loggers/__init__.py +0 -476
- bplusplus/yolov5detect/utils/loggers/clearml/README.md +0 -222
- bplusplus/yolov5detect/utils/loggers/clearml/__init__.py +0 -0
- bplusplus/yolov5detect/utils/loggers/clearml/clearml_utils.py +0 -230
- bplusplus/yolov5detect/utils/loggers/clearml/hpo.py +0 -90
- bplusplus/yolov5detect/utils/loggers/comet/README.md +0 -250
- bplusplus/yolov5detect/utils/loggers/comet/__init__.py +0 -551
- bplusplus/yolov5detect/utils/loggers/comet/comet_utils.py +0 -151
- bplusplus/yolov5detect/utils/loggers/comet/hpo.py +0 -126
- bplusplus/yolov5detect/utils/loggers/comet/optimizer_config.json +0 -135
- bplusplus/yolov5detect/utils/loggers/wandb/__init__.py +0 -0
- bplusplus/yolov5detect/utils/loggers/wandb/wandb_utils.py +0 -210
- bplusplus/yolov5detect/utils/loss.py +0 -259
- bplusplus/yolov5detect/utils/metrics.py +0 -381
- bplusplus/yolov5detect/utils/plots.py +0 -517
- bplusplus/yolov5detect/utils/segment/__init__.py +0 -0
- bplusplus/yolov5detect/utils/segment/augmentations.py +0 -100
- bplusplus/yolov5detect/utils/segment/dataloaders.py +0 -366
- bplusplus/yolov5detect/utils/segment/general.py +0 -160
- bplusplus/yolov5detect/utils/segment/loss.py +0 -198
- bplusplus/yolov5detect/utils/segment/metrics.py +0 -225
- bplusplus/yolov5detect/utils/segment/plots.py +0 -152
- bplusplus/yolov5detect/utils/torch_utils.py +0 -482
- bplusplus/yolov5detect/utils/triton.py +0 -90
- bplusplus-1.1.0.dist-info/METADATA +0 -179
- bplusplus-1.1.0.dist-info/RECORD +0 -92
- {bplusplus-1.1.0.dist-info → bplusplus-1.2.1.dist-info}/LICENSE +0 -0
- {bplusplus-1.1.0.dist-info → bplusplus-1.2.1.dist-info}/WHEEL +0 -0
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
"""Experimental modules."""
|
|
3
|
-
|
|
4
|
-
import math
|
|
5
|
-
|
|
6
|
-
import numpy as np
|
|
7
|
-
import torch
|
|
8
|
-
import torch.nn as nn
|
|
9
|
-
|
|
10
|
-
from utils.downloads import attempt_download
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class Sum(nn.Module):
|
|
14
|
-
"""Weighted sum of 2 or more layers https://arxiv.org/abs/1911.09070."""
|
|
15
|
-
|
|
16
|
-
def __init__(self, n, weight=False):
|
|
17
|
-
"""Initializes a module to sum outputs of layers with number of inputs `n` and optional weighting, supporting 2+
|
|
18
|
-
inputs.
|
|
19
|
-
"""
|
|
20
|
-
super().__init__()
|
|
21
|
-
self.weight = weight # apply weights boolean
|
|
22
|
-
self.iter = range(n - 1) # iter object
|
|
23
|
-
if weight:
|
|
24
|
-
self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=True) # layer weights
|
|
25
|
-
|
|
26
|
-
def forward(self, x):
|
|
27
|
-
"""Processes input through a customizable weighted sum of `n` inputs, optionally applying learned weights."""
|
|
28
|
-
y = x[0] # no weight
|
|
29
|
-
if self.weight:
|
|
30
|
-
w = torch.sigmoid(self.w) * 2
|
|
31
|
-
for i in self.iter:
|
|
32
|
-
y = y + x[i + 1] * w[i]
|
|
33
|
-
else:
|
|
34
|
-
for i in self.iter:
|
|
35
|
-
y = y + x[i + 1]
|
|
36
|
-
return y
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class MixConv2d(nn.Module):
|
|
40
|
-
"""Mixed Depth-wise Conv https://arxiv.org/abs/1907.09595."""
|
|
41
|
-
|
|
42
|
-
def __init__(self, c1, c2, k=(1, 3), s=1, equal_ch=True):
|
|
43
|
-
"""Initializes MixConv2d with mixed depth-wise convolutional layers, taking input and output channels (c1, c2),
|
|
44
|
-
kernel sizes (k), stride (s), and channel distribution strategy (equal_ch).
|
|
45
|
-
"""
|
|
46
|
-
super().__init__()
|
|
47
|
-
n = len(k) # number of convolutions
|
|
48
|
-
if equal_ch: # equal c_ per group
|
|
49
|
-
i = torch.linspace(0, n - 1e-6, c2).floor() # c2 indices
|
|
50
|
-
c_ = [(i == g).sum() for g in range(n)] # intermediate channels
|
|
51
|
-
else: # equal weight.numel() per group
|
|
52
|
-
b = [c2] + [0] * n
|
|
53
|
-
a = np.eye(n + 1, n, k=-1)
|
|
54
|
-
a -= np.roll(a, 1, axis=1)
|
|
55
|
-
a *= np.array(k) ** 2
|
|
56
|
-
a[0] = 1
|
|
57
|
-
c_ = np.linalg.lstsq(a, b, rcond=None)[0].round() # solve for equal weight indices, ax = b
|
|
58
|
-
|
|
59
|
-
self.m = nn.ModuleList(
|
|
60
|
-
[nn.Conv2d(c1, int(c_), k, s, k // 2, groups=math.gcd(c1, int(c_)), bias=False) for k, c_ in zip(k, c_)]
|
|
61
|
-
)
|
|
62
|
-
self.bn = nn.BatchNorm2d(c2)
|
|
63
|
-
self.act = nn.SiLU()
|
|
64
|
-
|
|
65
|
-
def forward(self, x):
|
|
66
|
-
"""Performs forward pass by applying SiLU activation on batch-normalized concatenated convolutional layer
|
|
67
|
-
outputs.
|
|
68
|
-
"""
|
|
69
|
-
return self.act(self.bn(torch.cat([m(x) for m in self.m], 1)))
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
class Ensemble(nn.ModuleList):
|
|
73
|
-
"""Ensemble of models."""
|
|
74
|
-
|
|
75
|
-
def __init__(self):
|
|
76
|
-
"""Initializes an ensemble of models to be used for aggregated predictions."""
|
|
77
|
-
super().__init__()
|
|
78
|
-
|
|
79
|
-
def forward(self, x, augment=False, profile=False, visualize=False):
|
|
80
|
-
"""Performs forward pass aggregating outputs from an ensemble of models.."""
|
|
81
|
-
y = [module(x, augment, profile, visualize)[0] for module in self]
|
|
82
|
-
# y = torch.stack(y).max(0)[0] # max ensemble
|
|
83
|
-
# y = torch.stack(y).mean(0) # mean ensemble
|
|
84
|
-
y = torch.cat(y, 1) # nms ensemble
|
|
85
|
-
return y, None # inference, train output
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def attempt_load(weights, device=None, inplace=True, fuse=True):
|
|
89
|
-
"""
|
|
90
|
-
Loads and fuses an ensemble or single YOLOv5 model from weights, handling device placement and model adjustments.
|
|
91
|
-
|
|
92
|
-
Example inputs: weights=[a,b,c] or a single model weights=[a] or weights=a.
|
|
93
|
-
"""
|
|
94
|
-
from models.yolo import Detect, Model
|
|
95
|
-
|
|
96
|
-
model = Ensemble()
|
|
97
|
-
for w in weights if isinstance(weights, list) else [weights]:
|
|
98
|
-
ckpt = torch.load(attempt_download(w), map_location="cpu") # load
|
|
99
|
-
ckpt = (ckpt.get("ema") or ckpt["model"]).to(device).float() # FP32 model
|
|
100
|
-
|
|
101
|
-
# Model compatibility updates
|
|
102
|
-
if not hasattr(ckpt, "stride"):
|
|
103
|
-
ckpt.stride = torch.tensor([32.0])
|
|
104
|
-
if hasattr(ckpt, "names") and isinstance(ckpt.names, (list, tuple)):
|
|
105
|
-
ckpt.names = dict(enumerate(ckpt.names)) # convert to dict
|
|
106
|
-
|
|
107
|
-
model.append(ckpt.fuse().eval() if fuse and hasattr(ckpt, "fuse") else ckpt.eval()) # model in eval mode
|
|
108
|
-
|
|
109
|
-
# Module updates
|
|
110
|
-
for m in model.modules():
|
|
111
|
-
t = type(m)
|
|
112
|
-
if t in (nn.Hardswish, nn.LeakyReLU, nn.ReLU, nn.ReLU6, nn.SiLU, Detect, Model):
|
|
113
|
-
m.inplace = inplace
|
|
114
|
-
if t is Detect and not isinstance(m.anchor_grid, list):
|
|
115
|
-
delattr(m, "anchor_grid")
|
|
116
|
-
setattr(m, "anchor_grid", [torch.zeros(1)] * m.nl)
|
|
117
|
-
elif t is nn.Upsample and not hasattr(m, "recompute_scale_factor"):
|
|
118
|
-
m.recompute_scale_factor = None # torch 1.11.0 compatibility
|
|
119
|
-
|
|
120
|
-
# Return model
|
|
121
|
-
if len(model) == 1:
|
|
122
|
-
return model[-1]
|
|
123
|
-
|
|
124
|
-
# Return detection ensemble
|
|
125
|
-
print(f"Ensemble created with {weights}\n")
|
|
126
|
-
for k in "names", "nc", "yaml":
|
|
127
|
-
setattr(model, k, getattr(model[0], k))
|
|
128
|
-
model.stride = model[torch.argmax(torch.tensor([m.stride.max() for m in model])).int()].stride # max stride
|
|
129
|
-
assert all(model[0].nc == m.nc for m in model), f"Models have different class counts: {[m.nc for m in model]}"
|
|
130
|
-
return model
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
# Default anchors for COCO data
|
|
3
|
-
|
|
4
|
-
# P5 -------------------------------------------------------------------------------------------------------------------
|
|
5
|
-
# P5-640:
|
|
6
|
-
anchors_p5_640:
|
|
7
|
-
- [10, 13, 16, 30, 33, 23] # P3/8
|
|
8
|
-
- [30, 61, 62, 45, 59, 119] # P4/16
|
|
9
|
-
- [116, 90, 156, 198, 373, 326] # P5/32
|
|
10
|
-
|
|
11
|
-
# P6 -------------------------------------------------------------------------------------------------------------------
|
|
12
|
-
# P6-640: thr=0.25: 0.9964 BPR, 5.54 anchors past thr, n=12, img_size=640, metric_all=0.281/0.716-mean/best, past_thr=0.469-mean: 9,11, 21,19, 17,41, 43,32, 39,70, 86,64, 65,131, 134,130, 120,265, 282,180, 247,354, 512,387
|
|
13
|
-
anchors_p6_640:
|
|
14
|
-
- [9, 11, 21, 19, 17, 41] # P3/8
|
|
15
|
-
- [43, 32, 39, 70, 86, 64] # P4/16
|
|
16
|
-
- [65, 131, 134, 130, 120, 265] # P5/32
|
|
17
|
-
- [282, 180, 247, 354, 512, 387] # P6/64
|
|
18
|
-
|
|
19
|
-
# P6-1280: thr=0.25: 0.9950 BPR, 5.55 anchors past thr, n=12, img_size=1280, metric_all=0.281/0.714-mean/best, past_thr=0.468-mean: 19,27, 44,40, 38,94, 96,68, 86,152, 180,137, 140,301, 303,264, 238,542, 436,615, 739,380, 925,792
|
|
20
|
-
anchors_p6_1280:
|
|
21
|
-
- [19, 27, 44, 40, 38, 94] # P3/8
|
|
22
|
-
- [96, 68, 86, 152, 180, 137] # P4/16
|
|
23
|
-
- [140, 301, 303, 264, 238, 542] # P5/32
|
|
24
|
-
- [436, 615, 739, 380, 925, 792] # P6/64
|
|
25
|
-
|
|
26
|
-
# P6-1920: thr=0.25: 0.9950 BPR, 5.55 anchors past thr, n=12, img_size=1920, metric_all=0.281/0.714-mean/best, past_thr=0.468-mean: 28,41, 67,59, 57,141, 144,103, 129,227, 270,205, 209,452, 455,396, 358,812, 653,922, 1109,570, 1387,1187
|
|
27
|
-
anchors_p6_1920:
|
|
28
|
-
- [28, 41, 67, 59, 57, 141] # P3/8
|
|
29
|
-
- [144, 103, 129, 227, 270, 205] # P4/16
|
|
30
|
-
- [209, 452, 455, 396, 358, 812] # P5/32
|
|
31
|
-
- [653, 922, 1109, 570, 1387, 1187] # P6/64
|
|
32
|
-
|
|
33
|
-
# P7 -------------------------------------------------------------------------------------------------------------------
|
|
34
|
-
# P7-640: thr=0.25: 0.9962 BPR, 6.76 anchors past thr, n=15, img_size=640, metric_all=0.275/0.733-mean/best, past_thr=0.466-mean: 11,11, 13,30, 29,20, 30,46, 61,38, 39,92, 78,80, 146,66, 79,163, 149,150, 321,143, 157,303, 257,402, 359,290, 524,372
|
|
35
|
-
anchors_p7_640:
|
|
36
|
-
- [11, 11, 13, 30, 29, 20] # P3/8
|
|
37
|
-
- [30, 46, 61, 38, 39, 92] # P4/16
|
|
38
|
-
- [78, 80, 146, 66, 79, 163] # P5/32
|
|
39
|
-
- [149, 150, 321, 143, 157, 303] # P6/64
|
|
40
|
-
- [257, 402, 359, 290, 524, 372] # P7/128
|
|
41
|
-
|
|
42
|
-
# P7-1280: thr=0.25: 0.9968 BPR, 6.71 anchors past thr, n=15, img_size=1280, metric_all=0.273/0.732-mean/best, past_thr=0.463-mean: 19,22, 54,36, 32,77, 70,83, 138,71, 75,173, 165,159, 148,334, 375,151, 334,317, 251,626, 499,474, 750,326, 534,814, 1079,818
|
|
43
|
-
anchors_p7_1280:
|
|
44
|
-
- [19, 22, 54, 36, 32, 77] # P3/8
|
|
45
|
-
- [70, 83, 138, 71, 75, 173] # P4/16
|
|
46
|
-
- [165, 159, 148, 334, 375, 151] # P5/32
|
|
47
|
-
- [334, 317, 251, 626, 499, 474] # P6/64
|
|
48
|
-
- [750, 326, 534, 814, 1079, 818] # P7/128
|
|
49
|
-
|
|
50
|
-
# P7-1920: thr=0.25: 0.9968 BPR, 6.71 anchors past thr, n=15, img_size=1920, metric_all=0.273/0.732-mean/best, past_thr=0.463-mean: 29,34, 81,55, 47,115, 105,124, 207,107, 113,259, 247,238, 222,500, 563,227, 501,476, 376,939, 749,711, 1126,489, 801,1222, 1618,1227
|
|
51
|
-
anchors_p7_1920:
|
|
52
|
-
- [29, 34, 81, 55, 47, 115] # P3/8
|
|
53
|
-
- [105, 124, 207, 107, 113, 259] # P4/16
|
|
54
|
-
- [247, 238, 222, 500, 563, 227] # P5/32
|
|
55
|
-
- [501, 476, 376, 939, 749, 711] # P6/64
|
|
56
|
-
- [1126, 489, 801, 1222, 1618, 1227] # P7/128
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
# Parameters
|
|
4
|
-
nc: 80 # number of classes
|
|
5
|
-
depth_multiple: 1.0 # model depth multiple
|
|
6
|
-
width_multiple: 1.0 # layer channel multiple
|
|
7
|
-
anchors:
|
|
8
|
-
- [10, 13, 16, 30, 33, 23] # P3/8
|
|
9
|
-
- [30, 61, 62, 45, 59, 119] # P4/16
|
|
10
|
-
- [116, 90, 156, 198, 373, 326] # P5/32
|
|
11
|
-
|
|
12
|
-
# darknet53 backbone
|
|
13
|
-
backbone:
|
|
14
|
-
# [from, number, module, args]
|
|
15
|
-
[
|
|
16
|
-
[-1, 1, Conv, [32, 3, 1]], # 0
|
|
17
|
-
[-1, 1, Conv, [64, 3, 2]], # 1-P1/2
|
|
18
|
-
[-1, 1, Bottleneck, [64]],
|
|
19
|
-
[-1, 1, Conv, [128, 3, 2]], # 3-P2/4
|
|
20
|
-
[-1, 2, Bottleneck, [128]],
|
|
21
|
-
[-1, 1, Conv, [256, 3, 2]], # 5-P3/8
|
|
22
|
-
[-1, 8, Bottleneck, [256]],
|
|
23
|
-
[-1, 1, Conv, [512, 3, 2]], # 7-P4/16
|
|
24
|
-
[-1, 8, Bottleneck, [512]],
|
|
25
|
-
[-1, 1, Conv, [1024, 3, 2]], # 9-P5/32
|
|
26
|
-
[-1, 4, Bottleneck, [1024]], # 10
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
# YOLOv3-SPP head
|
|
30
|
-
head: [
|
|
31
|
-
[-1, 1, Bottleneck, [1024, False]],
|
|
32
|
-
[-1, 1, SPP, [512, [5, 9, 13]]],
|
|
33
|
-
[-1, 1, Conv, [1024, 3, 1]],
|
|
34
|
-
[-1, 1, Conv, [512, 1, 1]],
|
|
35
|
-
[-1, 1, Conv, [1024, 3, 1]], # 15 (P5/32-large)
|
|
36
|
-
|
|
37
|
-
[-2, 1, Conv, [256, 1, 1]],
|
|
38
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
39
|
-
[[-1, 8], 1, Concat, [1]], # cat backbone P4
|
|
40
|
-
[-1, 1, Bottleneck, [512, False]],
|
|
41
|
-
[-1, 1, Bottleneck, [512, False]],
|
|
42
|
-
[-1, 1, Conv, [256, 1, 1]],
|
|
43
|
-
[-1, 1, Conv, [512, 3, 1]], # 22 (P4/16-medium)
|
|
44
|
-
|
|
45
|
-
[-2, 1, Conv, [128, 1, 1]],
|
|
46
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
47
|
-
[[-1, 6], 1, Concat, [1]], # cat backbone P3
|
|
48
|
-
[-1, 1, Bottleneck, [256, False]],
|
|
49
|
-
[-1, 2, Bottleneck, [256, False]], # 27 (P3/8-small)
|
|
50
|
-
|
|
51
|
-
[[27, 22, 15], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
|
|
52
|
-
]
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
# Parameters
|
|
4
|
-
nc: 80 # number of classes
|
|
5
|
-
depth_multiple: 1.0 # model depth multiple
|
|
6
|
-
width_multiple: 1.0 # layer channel multiple
|
|
7
|
-
anchors:
|
|
8
|
-
- [10, 14, 23, 27, 37, 58] # P4/16
|
|
9
|
-
- [81, 82, 135, 169, 344, 319] # P5/32
|
|
10
|
-
|
|
11
|
-
# YOLOv3-tiny backbone
|
|
12
|
-
backbone:
|
|
13
|
-
# [from, number, module, args]
|
|
14
|
-
[
|
|
15
|
-
[-1, 1, Conv, [16, 3, 1]], # 0
|
|
16
|
-
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 1-P1/2
|
|
17
|
-
[-1, 1, Conv, [32, 3, 1]],
|
|
18
|
-
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 3-P2/4
|
|
19
|
-
[-1, 1, Conv, [64, 3, 1]],
|
|
20
|
-
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 5-P3/8
|
|
21
|
-
[-1, 1, Conv, [128, 3, 1]],
|
|
22
|
-
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 7-P4/16
|
|
23
|
-
[-1, 1, Conv, [256, 3, 1]],
|
|
24
|
-
[-1, 1, nn.MaxPool2d, [2, 2, 0]], # 9-P5/32
|
|
25
|
-
[-1, 1, Conv, [512, 3, 1]],
|
|
26
|
-
[-1, 1, nn.ZeroPad2d, [[0, 1, 0, 1]]], # 11
|
|
27
|
-
[-1, 1, nn.MaxPool2d, [2, 1, 0]], # 12
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
# YOLOv3-tiny head
|
|
31
|
-
head: [
|
|
32
|
-
[-1, 1, Conv, [1024, 3, 1]],
|
|
33
|
-
[-1, 1, Conv, [256, 1, 1]],
|
|
34
|
-
[-1, 1, Conv, [512, 3, 1]], # 15 (P5/32-large)
|
|
35
|
-
|
|
36
|
-
[-2, 1, Conv, [128, 1, 1]],
|
|
37
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
38
|
-
[[-1, 8], 1, Concat, [1]], # cat backbone P4
|
|
39
|
-
[-1, 1, Conv, [256, 3, 1]], # 19 (P4/16-medium)
|
|
40
|
-
|
|
41
|
-
[[19, 15], 1, Detect, [nc, anchors]], # Detect(P4, P5)
|
|
42
|
-
]
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
# Parameters
|
|
4
|
-
nc: 80 # number of classes
|
|
5
|
-
depth_multiple: 1.0 # model depth multiple
|
|
6
|
-
width_multiple: 1.0 # layer channel multiple
|
|
7
|
-
anchors:
|
|
8
|
-
- [10, 13, 16, 30, 33, 23] # P3/8
|
|
9
|
-
- [30, 61, 62, 45, 59, 119] # P4/16
|
|
10
|
-
- [116, 90, 156, 198, 373, 326] # P5/32
|
|
11
|
-
|
|
12
|
-
# darknet53 backbone
|
|
13
|
-
backbone:
|
|
14
|
-
# [from, number, module, args]
|
|
15
|
-
[
|
|
16
|
-
[-1, 1, Conv, [32, 3, 1]], # 0
|
|
17
|
-
[-1, 1, Conv, [64, 3, 2]], # 1-P1/2
|
|
18
|
-
[-1, 1, Bottleneck, [64]],
|
|
19
|
-
[-1, 1, Conv, [128, 3, 2]], # 3-P2/4
|
|
20
|
-
[-1, 2, Bottleneck, [128]],
|
|
21
|
-
[-1, 1, Conv, [256, 3, 2]], # 5-P3/8
|
|
22
|
-
[-1, 8, Bottleneck, [256]],
|
|
23
|
-
[-1, 1, Conv, [512, 3, 2]], # 7-P4/16
|
|
24
|
-
[-1, 8, Bottleneck, [512]],
|
|
25
|
-
[-1, 1, Conv, [1024, 3, 2]], # 9-P5/32
|
|
26
|
-
[-1, 4, Bottleneck, [1024]], # 10
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
# YOLOv3 head
|
|
30
|
-
head: [
|
|
31
|
-
[-1, 1, Bottleneck, [1024, False]],
|
|
32
|
-
[-1, 1, Conv, [512, 1, 1]],
|
|
33
|
-
[-1, 1, Conv, [1024, 3, 1]],
|
|
34
|
-
[-1, 1, Conv, [512, 1, 1]],
|
|
35
|
-
[-1, 1, Conv, [1024, 3, 1]], # 15 (P5/32-large)
|
|
36
|
-
|
|
37
|
-
[-2, 1, Conv, [256, 1, 1]],
|
|
38
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
39
|
-
[[-1, 8], 1, Concat, [1]], # cat backbone P4
|
|
40
|
-
[-1, 1, Bottleneck, [512, False]],
|
|
41
|
-
[-1, 1, Bottleneck, [512, False]],
|
|
42
|
-
[-1, 1, Conv, [256, 1, 1]],
|
|
43
|
-
[-1, 1, Conv, [512, 3, 1]], # 22 (P4/16-medium)
|
|
44
|
-
|
|
45
|
-
[-2, 1, Conv, [128, 1, 1]],
|
|
46
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
47
|
-
[[-1, 6], 1, Concat, [1]], # cat backbone P3
|
|
48
|
-
[-1, 1, Bottleneck, [256, False]],
|
|
49
|
-
[-1, 2, Bottleneck, [256, False]], # 27 (P3/8-small)
|
|
50
|
-
|
|
51
|
-
[[27, 22, 15], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
|
|
52
|
-
]
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
# Parameters
|
|
4
|
-
nc: 80 # number of classes
|
|
5
|
-
depth_multiple: 1.0 # model depth multiple
|
|
6
|
-
width_multiple: 1.0 # layer channel multiple
|
|
7
|
-
anchors:
|
|
8
|
-
- [10, 13, 16, 30, 33, 23] # P3/8
|
|
9
|
-
- [30, 61, 62, 45, 59, 119] # P4/16
|
|
10
|
-
- [116, 90, 156, 198, 373, 326] # P5/32
|
|
11
|
-
|
|
12
|
-
# YOLOv5 v6.0 backbone
|
|
13
|
-
backbone:
|
|
14
|
-
# [from, number, module, args]
|
|
15
|
-
[
|
|
16
|
-
[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
|
17
|
-
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
|
18
|
-
[-1, 3, C3, [128]],
|
|
19
|
-
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
|
20
|
-
[-1, 6, C3, [256]],
|
|
21
|
-
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
|
22
|
-
[-1, 9, C3, [512]],
|
|
23
|
-
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
|
24
|
-
[-1, 3, C3, [1024]],
|
|
25
|
-
[-1, 1, SPPF, [1024, 5]], # 9
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
# YOLOv5 v6.0 BiFPN head
|
|
29
|
-
head: [
|
|
30
|
-
[-1, 1, Conv, [512, 1, 1]],
|
|
31
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
32
|
-
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
|
33
|
-
[-1, 3, C3, [512, False]], # 13
|
|
34
|
-
|
|
35
|
-
[-1, 1, Conv, [256, 1, 1]],
|
|
36
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
37
|
-
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
|
38
|
-
[-1, 3, C3, [256, False]], # 17 (P3/8-small)
|
|
39
|
-
|
|
40
|
-
[-1, 1, Conv, [256, 3, 2]],
|
|
41
|
-
[[-1, 14, 6], 1, Concat, [1]], # cat P4 <--- BiFPN change
|
|
42
|
-
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)
|
|
43
|
-
|
|
44
|
-
[-1, 1, Conv, [512, 3, 2]],
|
|
45
|
-
[[-1, 10], 1, Concat, [1]], # cat head P5
|
|
46
|
-
[-1, 3, C3, [1024, False]], # 23 (P5/32-large)
|
|
47
|
-
|
|
48
|
-
[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
|
|
49
|
-
]
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
# Parameters
|
|
4
|
-
nc: 80 # number of classes
|
|
5
|
-
depth_multiple: 1.0 # model depth multiple
|
|
6
|
-
width_multiple: 1.0 # layer channel multiple
|
|
7
|
-
anchors:
|
|
8
|
-
- [10, 13, 16, 30, 33, 23] # P3/8
|
|
9
|
-
- [30, 61, 62, 45, 59, 119] # P4/16
|
|
10
|
-
- [116, 90, 156, 198, 373, 326] # P5/32
|
|
11
|
-
|
|
12
|
-
# YOLOv5 v6.0 backbone
|
|
13
|
-
backbone:
|
|
14
|
-
# [from, number, module, args]
|
|
15
|
-
[
|
|
16
|
-
[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
|
17
|
-
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
|
18
|
-
[-1, 3, C3, [128]],
|
|
19
|
-
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
|
20
|
-
[-1, 6, C3, [256]],
|
|
21
|
-
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
|
22
|
-
[-1, 9, C3, [512]],
|
|
23
|
-
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
|
24
|
-
[-1, 3, C3, [1024]],
|
|
25
|
-
[-1, 1, SPPF, [1024, 5]], # 9
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
# YOLOv5 v6.0 FPN head
|
|
29
|
-
head: [
|
|
30
|
-
[-1, 3, C3, [1024, False]], # 10 (P5/32-large)
|
|
31
|
-
|
|
32
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
33
|
-
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
|
34
|
-
[-1, 1, Conv, [512, 1, 1]],
|
|
35
|
-
[-1, 3, C3, [512, False]], # 14 (P4/16-medium)
|
|
36
|
-
|
|
37
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
38
|
-
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
|
39
|
-
[-1, 1, Conv, [256, 1, 1]],
|
|
40
|
-
[-1, 3, C3, [256, False]], # 18 (P3/8-small)
|
|
41
|
-
|
|
42
|
-
[[18, 14, 10], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
|
|
43
|
-
]
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
# Parameters
|
|
4
|
-
nc: 80 # number of classes
|
|
5
|
-
depth_multiple: 1.0 # model depth multiple
|
|
6
|
-
width_multiple: 1.0 # layer channel multiple
|
|
7
|
-
anchors: 3 # AutoAnchor evolves 3 anchors per P output layer
|
|
8
|
-
|
|
9
|
-
# YOLOv5 v6.0 backbone
|
|
10
|
-
backbone:
|
|
11
|
-
# [from, number, module, args]
|
|
12
|
-
[
|
|
13
|
-
[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
|
14
|
-
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
|
15
|
-
[-1, 3, C3, [128]],
|
|
16
|
-
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
|
17
|
-
[-1, 6, C3, [256]],
|
|
18
|
-
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
|
19
|
-
[-1, 9, C3, [512]],
|
|
20
|
-
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
|
21
|
-
[-1, 3, C3, [1024]],
|
|
22
|
-
[-1, 1, SPPF, [1024, 5]], # 9
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
# YOLOv5 v6.0 head with (P2, P3, P4, P5) outputs
|
|
26
|
-
head: [
|
|
27
|
-
[-1, 1, Conv, [512, 1, 1]],
|
|
28
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
29
|
-
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
|
30
|
-
[-1, 3, C3, [512, False]], # 13
|
|
31
|
-
|
|
32
|
-
[-1, 1, Conv, [256, 1, 1]],
|
|
33
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
34
|
-
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
|
35
|
-
[-1, 3, C3, [256, False]], # 17 (P3/8-small)
|
|
36
|
-
|
|
37
|
-
[-1, 1, Conv, [128, 1, 1]],
|
|
38
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
39
|
-
[[-1, 2], 1, Concat, [1]], # cat backbone P2
|
|
40
|
-
[-1, 1, C3, [128, False]], # 21 (P2/4-xsmall)
|
|
41
|
-
|
|
42
|
-
[-1, 1, Conv, [128, 3, 2]],
|
|
43
|
-
[[-1, 18], 1, Concat, [1]], # cat head P3
|
|
44
|
-
[-1, 3, C3, [256, False]], # 24 (P3/8-small)
|
|
45
|
-
|
|
46
|
-
[-1, 1, Conv, [256, 3, 2]],
|
|
47
|
-
[[-1, 14], 1, Concat, [1]], # cat head P4
|
|
48
|
-
[-1, 3, C3, [512, False]], # 27 (P4/16-medium)
|
|
49
|
-
|
|
50
|
-
[-1, 1, Conv, [512, 3, 2]],
|
|
51
|
-
[[-1, 10], 1, Concat, [1]], # cat head P5
|
|
52
|
-
[-1, 3, C3, [1024, False]], # 30 (P5/32-large)
|
|
53
|
-
|
|
54
|
-
[[21, 24, 27, 30], 1, Detect, [nc, anchors]], # Detect(P2, P3, P4, P5)
|
|
55
|
-
]
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
# Parameters
|
|
4
|
-
nc: 80 # number of classes
|
|
5
|
-
depth_multiple: 0.33 # model depth multiple
|
|
6
|
-
width_multiple: 0.50 # layer channel multiple
|
|
7
|
-
anchors: 3 # AutoAnchor evolves 3 anchors per P output layer
|
|
8
|
-
|
|
9
|
-
# YOLOv5 v6.0 backbone
|
|
10
|
-
backbone:
|
|
11
|
-
# [from, number, module, args]
|
|
12
|
-
[
|
|
13
|
-
[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
|
14
|
-
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
|
15
|
-
[-1, 3, C3, [128]],
|
|
16
|
-
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
|
17
|
-
[-1, 6, C3, [256]],
|
|
18
|
-
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
|
19
|
-
[-1, 9, C3, [512]],
|
|
20
|
-
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
|
|
21
|
-
[-1, 3, C3, [1024]],
|
|
22
|
-
[-1, 1, SPPF, [1024, 5]], # 9
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
# YOLOv5 v6.0 head with (P3, P4) outputs
|
|
26
|
-
head: [
|
|
27
|
-
[-1, 1, Conv, [512, 1, 1]],
|
|
28
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
29
|
-
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
|
30
|
-
[-1, 3, C3, [512, False]], # 13
|
|
31
|
-
|
|
32
|
-
[-1, 1, Conv, [256, 1, 1]],
|
|
33
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
34
|
-
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
|
35
|
-
[-1, 3, C3, [256, False]], # 17 (P3/8-small)
|
|
36
|
-
|
|
37
|
-
[-1, 1, Conv, [256, 3, 2]],
|
|
38
|
-
[[-1, 14], 1, Concat, [1]], # cat head P4
|
|
39
|
-
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)
|
|
40
|
-
|
|
41
|
-
[[17, 20], 1, Detect, [nc, anchors]], # Detect(P3, P4)
|
|
42
|
-
]
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
# Parameters
|
|
4
|
-
nc: 80 # number of classes
|
|
5
|
-
depth_multiple: 1.0 # model depth multiple
|
|
6
|
-
width_multiple: 1.0 # layer channel multiple
|
|
7
|
-
anchors: 3 # AutoAnchor evolves 3 anchors per P output layer
|
|
8
|
-
|
|
9
|
-
# YOLOv5 v6.0 backbone
|
|
10
|
-
backbone:
|
|
11
|
-
# [from, number, module, args]
|
|
12
|
-
[
|
|
13
|
-
[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
|
14
|
-
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
|
15
|
-
[-1, 3, C3, [128]],
|
|
16
|
-
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
|
17
|
-
[-1, 6, C3, [256]],
|
|
18
|
-
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
|
19
|
-
[-1, 9, C3, [512]],
|
|
20
|
-
[-1, 1, Conv, [768, 3, 2]], # 7-P5/32
|
|
21
|
-
[-1, 3, C3, [768]],
|
|
22
|
-
[-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
|
|
23
|
-
[-1, 3, C3, [1024]],
|
|
24
|
-
[-1, 1, SPPF, [1024, 5]], # 11
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
# YOLOv5 v6.0 head with (P3, P4, P5, P6) outputs
|
|
28
|
-
head: [
|
|
29
|
-
[-1, 1, Conv, [768, 1, 1]],
|
|
30
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
31
|
-
[[-1, 8], 1, Concat, [1]], # cat backbone P5
|
|
32
|
-
[-1, 3, C3, [768, False]], # 15
|
|
33
|
-
|
|
34
|
-
[-1, 1, Conv, [512, 1, 1]],
|
|
35
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
36
|
-
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
|
37
|
-
[-1, 3, C3, [512, False]], # 19
|
|
38
|
-
|
|
39
|
-
[-1, 1, Conv, [256, 1, 1]],
|
|
40
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
41
|
-
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
|
42
|
-
[-1, 3, C3, [256, False]], # 23 (P3/8-small)
|
|
43
|
-
|
|
44
|
-
[-1, 1, Conv, [256, 3, 2]],
|
|
45
|
-
[[-1, 20], 1, Concat, [1]], # cat head P4
|
|
46
|
-
[-1, 3, C3, [512, False]], # 26 (P4/16-medium)
|
|
47
|
-
|
|
48
|
-
[-1, 1, Conv, [512, 3, 2]],
|
|
49
|
-
[[-1, 16], 1, Concat, [1]], # cat head P5
|
|
50
|
-
[-1, 3, C3, [768, False]], # 29 (P5/32-large)
|
|
51
|
-
|
|
52
|
-
[-1, 1, Conv, [768, 3, 2]],
|
|
53
|
-
[[-1, 12], 1, Concat, [1]], # cat head P6
|
|
54
|
-
[-1, 3, C3, [1024, False]], # 32 (P6/64-xlarge)
|
|
55
|
-
|
|
56
|
-
[[23, 26, 29, 32], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5, P6)
|
|
57
|
-
]
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
# Parameters
|
|
4
|
-
nc: 80 # number of classes
|
|
5
|
-
depth_multiple: 1.0 # model depth multiple
|
|
6
|
-
width_multiple: 1.0 # layer channel multiple
|
|
7
|
-
anchors: 3 # AutoAnchor evolves 3 anchors per P output layer
|
|
8
|
-
|
|
9
|
-
# YOLOv5 v6.0 backbone
|
|
10
|
-
backbone:
|
|
11
|
-
# [from, number, module, args]
|
|
12
|
-
[
|
|
13
|
-
[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
|
|
14
|
-
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
|
|
15
|
-
[-1, 3, C3, [128]],
|
|
16
|
-
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
|
|
17
|
-
[-1, 6, C3, [256]],
|
|
18
|
-
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
|
|
19
|
-
[-1, 9, C3, [512]],
|
|
20
|
-
[-1, 1, Conv, [768, 3, 2]], # 7-P5/32
|
|
21
|
-
[-1, 3, C3, [768]],
|
|
22
|
-
[-1, 1, Conv, [1024, 3, 2]], # 9-P6/64
|
|
23
|
-
[-1, 3, C3, [1024]],
|
|
24
|
-
[-1, 1, Conv, [1280, 3, 2]], # 11-P7/128
|
|
25
|
-
[-1, 3, C3, [1280]],
|
|
26
|
-
[-1, 1, SPPF, [1280, 5]], # 13
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
# YOLOv5 v6.0 head with (P3, P4, P5, P6, P7) outputs
|
|
30
|
-
head: [
|
|
31
|
-
[-1, 1, Conv, [1024, 1, 1]],
|
|
32
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
33
|
-
[[-1, 10], 1, Concat, [1]], # cat backbone P6
|
|
34
|
-
[-1, 3, C3, [1024, False]], # 17
|
|
35
|
-
|
|
36
|
-
[-1, 1, Conv, [768, 1, 1]],
|
|
37
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
38
|
-
[[-1, 8], 1, Concat, [1]], # cat backbone P5
|
|
39
|
-
[-1, 3, C3, [768, False]], # 21
|
|
40
|
-
|
|
41
|
-
[-1, 1, Conv, [512, 1, 1]],
|
|
42
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
43
|
-
[[-1, 6], 1, Concat, [1]], # cat backbone P4
|
|
44
|
-
[-1, 3, C3, [512, False]], # 25
|
|
45
|
-
|
|
46
|
-
[-1, 1, Conv, [256, 1, 1]],
|
|
47
|
-
[-1, 1, nn.Upsample, [None, 2, "nearest"]],
|
|
48
|
-
[[-1, 4], 1, Concat, [1]], # cat backbone P3
|
|
49
|
-
[-1, 3, C3, [256, False]], # 29 (P3/8-small)
|
|
50
|
-
|
|
51
|
-
[-1, 1, Conv, [256, 3, 2]],
|
|
52
|
-
[[-1, 26], 1, Concat, [1]], # cat head P4
|
|
53
|
-
[-1, 3, C3, [512, False]], # 32 (P4/16-medium)
|
|
54
|
-
|
|
55
|
-
[-1, 1, Conv, [512, 3, 2]],
|
|
56
|
-
[[-1, 22], 1, Concat, [1]], # cat head P5
|
|
57
|
-
[-1, 3, C3, [768, False]], # 35 (P5/32-large)
|
|
58
|
-
|
|
59
|
-
[-1, 1, Conv, [768, 3, 2]],
|
|
60
|
-
[[-1, 18], 1, Concat, [1]], # cat head P6
|
|
61
|
-
[-1, 3, C3, [1024, False]], # 38 (P6/64-xlarge)
|
|
62
|
-
|
|
63
|
-
[-1, 1, Conv, [1024, 3, 2]],
|
|
64
|
-
[[-1, 14], 1, Concat, [1]], # cat head P7
|
|
65
|
-
[-1, 3, C3, [1280, False]], # 41 (P7/128-xxlarge)
|
|
66
|
-
|
|
67
|
-
[[29, 32, 35, 38, 41], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5, P6, P7)
|
|
68
|
-
]
|