|
|
|
@ -9,7 +9,7 @@ from torch.nn.init import constant_, xavier_uniform_ |
|
|
|
|
|
|
|
|
|
from ultralytics.utils.tal import TORCH_1_10, dist2bbox, dist2rbox, make_anchors |
|
|
|
|
from .block import DFL, BNContrastiveHead, ContrastiveHead, Proto |
|
|
|
|
from .conv import Conv |
|
|
|
|
from .conv import Conv, DWConv |
|
|
|
|
from .transformer import MLP, DeformableTransformerDecoder, DeformableTransformerDecoderLayer |
|
|
|
|
from .utils import bias_init_with_prob, linear_init |
|
|
|
|
|
|
|
|
@ -37,7 +37,15 @@ class Detect(nn.Module): |
|
|
|
|
self.cv2 = nn.ModuleList( |
|
|
|
|
nn.Sequential(Conv(x, c2, 3), Conv(c2, c2, 3), nn.Conv2d(c2, 4 * self.reg_max, 1)) for x in ch |
|
|
|
|
) |
|
|
|
|
self.cv3 = nn.ModuleList(nn.Sequential(Conv(x, c3, 3), Conv(c3, c3, 3), nn.Conv2d(c3, self.nc, 1)) for x in ch) |
|
|
|
|
# self.cv3 = nn.ModuleList(nn.Sequential(Conv(x, c3, 3), Conv(c3, c3, 3), nn.Conv2d(c3, self.nc, 1)) for x in ch) |
|
|
|
|
self.cv3 = nn.ModuleList( |
|
|
|
|
nn.Sequential( |
|
|
|
|
nn.Sequential(DWConv(x, x, 3), Conv(x, c3, 1)), |
|
|
|
|
nn.Sequential(DWConv(c3, c3, 3), Conv(c3, c3, 1)), |
|
|
|
|
nn.Conv2d(c3, self.nc, 1), |
|
|
|
|
) |
|
|
|
|
for x in ch |
|
|
|
|
) |
|
|
|
|
self.dfl = DFL(self.reg_max) if self.reg_max > 1 else nn.Identity() |
|
|
|
|
|
|
|
|
|
def forward(self, x): |
|
|
|
|