updates
This commit is contained in:
parent
37799efa0b
commit
0bac735cc6
|
@ -106,7 +106,8 @@ class YOLOLayer(nn.Module):
|
||||||
self.anchors = torch.Tensor(anchors)
|
self.anchors = torch.Tensor(anchors)
|
||||||
self.na = len(anchors) # number of anchors (3)
|
self.na = len(anchors) # number of anchors (3)
|
||||||
self.nc = nc # number of classes (80)
|
self.nc = nc # number of classes (80)
|
||||||
self.img_size = 0
|
self.nx = 0 # initialize number of x gridpoints
|
||||||
|
self.ny = 0 # initialize number of y gridpoints
|
||||||
|
|
||||||
if ONNX_EXPORT: # grids must be computed in __init__
|
if ONNX_EXPORT: # grids must be computed in __init__
|
||||||
stride = [32, 16, 8][yolo_layer] # stride of this layer
|
stride = [32, 16, 8][yolo_layer] # stride of this layer
|
||||||
|
@ -121,7 +122,7 @@ class YOLOLayer(nn.Module):
|
||||||
bs = 1 # batch size
|
bs = 1 # batch size
|
||||||
else:
|
else:
|
||||||
bs, nx, ny = p.shape[0], p.shape[-2], p.shape[-1]
|
bs, nx, ny = p.shape[0], p.shape[-2], p.shape[-1]
|
||||||
if self.img_size != img_size:
|
if (self.nx, self.ny) != (nx, ny):
|
||||||
create_grids(self, img_size, (nx, ny), p.device)
|
create_grids(self, img_size, (nx, ny), p.device)
|
||||||
|
|
||||||
# p.view(bs, 255, 13, 13) -- > (bs, 3, 13, 13, 85) # (bs, anchors, grid, grid, classes + xywh)
|
# p.view(bs, 255, 13, 13) -- > (bs, 3, 13, 13, 85) # (bs, anchors, grid, grid, classes + xywh)
|
||||||
|
|
|
@ -75,6 +75,7 @@ class LoadImages: # for inference
|
||||||
|
|
||||||
# Padded resize
|
# Padded resize
|
||||||
img, _, _, _ = letterbox_rect(img0, height=self.height)
|
img, _, _, _ = letterbox_rect(img0, height=self.height)
|
||||||
|
print('%gx%g ' % img.shape[:2], end='') # print image size
|
||||||
|
|
||||||
# Normalize RGB
|
# Normalize RGB
|
||||||
img = img[:, :, ::-1].transpose(2, 0, 1) # BGR to RGB
|
img = img[:, :, ::-1].transpose(2, 0, 1) # BGR to RGB
|
||||||
|
|
Loading…
Reference in New Issue