Skip to content

Commit

Permalink
Fix np, uda dev issue (WongKinYiu#1272)
Browse files Browse the repository at this point in the history
Limit numpy version to avoid issue with tensorboard, conv np.int to just int, fix  mismatched device issuecuda dev issue
  • Loading branch information
SamSamhuns authored Dec 28, 2022
1 parent 8e9f0b7 commit 557e383
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Base ----------------------------------------
matplotlib>=3.2.2
numpy>=1.18.5
numpy>=1.18.5,<1.24.0
opencv-python>=4.1.1
Pillow>=7.1.2
PyYAML>=5.3.1
Expand Down
4 changes: 2 additions & 2 deletions utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def __init__(self, path, img_size=640, batch_size=16, augment=False, hyp=None, r
x[:, 0] = 0

n = len(shapes) # number of images
bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index
bi = np.floor(np.arange(n) / batch_size).astype(int) # batch index
nb = bi[-1] + 1 # number of batches
self.batch = bi # batch index of image
self.n = n
Expand Down Expand Up @@ -443,7 +443,7 @@ def __init__(self, path, img_size=640, batch_size=16, augment=False, hyp=None, r
elif mini > 1:
shapes[i] = [1, 1 / mini]

self.batch_shapes = np.ceil(np.array(shapes) * img_size / stride + pad).astype(np.int) * stride
self.batch_shapes = np.ceil(np.array(shapes) * img_size / stride + pad).astype(int) * stride

# Cache images into memory for faster training (WARNING: large datasets may exceed system RAM)
self.imgs = [None] * n
Expand Down
2 changes: 1 addition & 1 deletion utils/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def build_targets(self, p, targets, imgs):
+ 3.0 * pair_wise_iou_loss
)

matching_matrix = torch.zeros_like(cost)
matching_matrix = torch.zeros_like(cost, device="cpu")

for gt_idx in range(num_gt):
_, pos_idx = torch.topk(
Expand Down

0 comments on commit 557e383

Please sign in to comment.