Просмотр исходного кода

Fix torch `long` to `float` tensor on HUB macOS (#8067)

modifyDataloader
Glenn Jocher GitHub 2 лет назад
Родитель
Сommit
7cef03dddd
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
1 измененных файлов: 3 добавлений и 3 удалений
  1. +3
    -3
      utils/loss.py

+ 3
- 3
utils/loss.py Просмотреть файл

@@ -195,8 +195,8 @@ class ComputeLoss:
device=self.device).float() * g # offsets

for i in range(self.nl):
anchors = self.anchors[i]
gain[2:6] = torch.tensor(p[i].shape)[[3, 2, 3, 2]] # xyxy gain
anchors, shape = self.anchors[i], p[i].shape
gain[2:6] = torch.tensor(shape)[[3, 2, 3, 2]] # xyxy gain

# Match targets to anchors
t = targets * gain # shape(3,n,7)
@@ -226,7 +226,7 @@ class ComputeLoss:
gi, gj = gij.T # grid indices

# Append
indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices
indices.append((b, a, gj.clamp_(0, shape[2] - 1), gi.clamp_(0, shape[3] - 1))) # image, anchor, grid
tbox.append(torch.cat((gxy - gij, gwh), 1)) # box
anch.append(anchors[a]) # anchors
tcls.append(c) # class

Загрузка…
Отмена
Сохранить