From 557e3837afe74bb1996b4f82c5d59055a725acdd Mon Sep 17 00:00:00 2001 From: Sam_S Date: Wed, 28 Dec 2022 07:39:34 +0400 Subject: [PATCH] Fix np, uda dev issue (#1272) Limit numpy version to avoid issue with tensorboard, conv np.int to just int, fix mismatched device issuecuda dev issue --- requirements.txt | 2 +- utils/datasets.py | 4 ++-- utils/loss.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6b71f21..f4d2182 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/utils/datasets.py b/utils/datasets.py index b6bb8b0..b4e56ad 100644 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -415,7 +415,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing 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 @@ -443,7 +443,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing 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 diff --git a/utils/loss.py b/utils/loss.py index bf7ab65..6eb70a2 100644 --- a/utils/loss.py +++ b/utils/loss.py @@ -739,7 +739,7 @@ class ComputeLossOTA: + 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(