@@ -1115,7 +1115,7 @@ def find_3_positive(self, p, targets):
1115
1115
# Build targets for compute_loss(), input targets(image,class,x,y,w,h)
1116
1116
na , nt = self .na , targets .shape [0 ] # number of anchors, targets
1117
1117
indices , anch = [], []
1118
- gain = torch .ones (7 , device = targets .device ) # normalized to gridspace gain
1118
+ gain = torch .ones (7 , device = targets .device ). long () # normalized to gridspace gain
1119
1119
ai = torch .arange (na , device = targets .device ).float ().view (na , 1 ).repeat (1 , nt ) # same as .repeat_interleave(nt)
1120
1120
targets = torch .cat ((targets .repeat (na , 1 , 1 ), ai [:, :, None ]), 2 ) # append anchor indices
1121
1121
@@ -1561,7 +1561,7 @@ def find_5_positive(self, p, targets):
1561
1561
# Build targets for compute_loss(), input targets(image,class,x,y,w,h)
1562
1562
na , nt = self .na , targets .shape [0 ] # number of anchors, targets
1563
1563
indices , anch = [], []
1564
- gain = torch .ones (7 , device = targets .device ) # normalized to gridspace gain
1564
+ gain = torch .ones (7 , device = targets .device ). long () # normalized to gridspace gain
1565
1565
ai = torch .arange (na , device = targets .device ).float ().view (na , 1 ).repeat (1 , nt ) # same as .repeat_interleave(nt)
1566
1566
targets = torch .cat ((targets .repeat (na , 1 , 1 ), ai [:, :, None ]), 2 ) # append anchor indices
1567
1567
@@ -1614,7 +1614,7 @@ def find_3_positive(self, p, targets):
1614
1614
# Build targets for compute_loss(), input targets(image,class,x,y,w,h)
1615
1615
na , nt = self .na , targets .shape [0 ] # number of anchors, targets
1616
1616
indices , anch = [], []
1617
- gain = torch .ones (7 , device = targets .device ) # normalized to gridspace gain
1617
+ gain = torch .ones (7 , device = targets .device ). long () # normalized to gridspace gain
1618
1618
ai = torch .arange (na , device = targets .device ).float ().view (na , 1 ).repeat (1 , nt ) # same as .repeat_interleave(nt)
1619
1619
targets = torch .cat ((targets .repeat (na , 1 , 1 ), ai [:, :, None ]), 2 ) # append anchor indices
1620
1620
0 commit comments