updates
This commit is contained in:
+4
-3
@@ -23,6 +23,7 @@ class ImageFolder(): # for eval-only
|
||||
self.nB = math.ceil(self.nF / batch_size) # number of batches
|
||||
self.batch_size = batch_size
|
||||
self.height = img_size
|
||||
|
||||
assert self.nF > 0, 'No images found in path %s' % path
|
||||
|
||||
# RGB normalization values
|
||||
@@ -65,7 +66,7 @@ class ListDataset(): # for training
|
||||
with open(path, 'r') as file:
|
||||
self.img_files = file.readlines()
|
||||
|
||||
if platform == 'darwin': # macos
|
||||
if platform == 'darwin': # MacOS (local)
|
||||
self.img_files = [path.replace('\n', '').replace('/images', '/Users/glennjocher/Downloads/DATA/coco/images')
|
||||
for path in self.img_files]
|
||||
else: # linux (gcp cloud)
|
||||
@@ -77,10 +78,10 @@ class ListDataset(): # for training
|
||||
self.nF = len(self.img_files) # number of image files
|
||||
self.nB = math.ceil(self.nF / batch_size) # number of batches
|
||||
self.batch_size = batch_size
|
||||
|
||||
# assert self.nB > 0, 'No images found in path %s' % path
|
||||
self.height = img_size
|
||||
|
||||
assert self.nB > 0, 'No images found in path %s' % path
|
||||
|
||||
# RGB normalization values
|
||||
# self.rgb_mean = np.array([60.134, 49.697, 40.746], dtype=np.float32).reshape((1, 3, 1, 1))
|
||||
# self.rgb_std = np.array([29.99, 24.498, 22.046], dtype=np.float32).reshape((1, 3, 1, 1))
|
||||
|
||||
+6
-6
@@ -62,7 +62,7 @@ def weights_init_normal(m):
|
||||
|
||||
|
||||
def xyxy2xywh(x): # Convert bounding box format from [x1, y1, x2, y2] to [x, y, w, h]
|
||||
y = np.zeros(x.shape)
|
||||
y = torch.zeros(x.shape) if x.dtype is torch.float32 else np.zeros(x.shape)
|
||||
y[:, 0] = (x[:, 0] + x[:, 2]) / 2
|
||||
y[:, 1] = (x[:, 1] + x[:, 3]) / 2
|
||||
y[:, 2] = x[:, 2] - x[:, 0]
|
||||
@@ -71,11 +71,11 @@ def xyxy2xywh(x): # Convert bounding box format from [x1, y1, x2, y2] to [x, y,
|
||||
|
||||
|
||||
def xywh2xyxy(x): # Convert bounding box format from [x, y, w, h] to [x1, y1, x2, y2]
|
||||
y = np.zeros(x.shape)
|
||||
y[:, 0] = (x[:, 1] - x[:, 3] / 2)
|
||||
y[:, 1] = (x[:, 2] - x[:, 4] / 2)
|
||||
y[:, 2] = (x[:, 1] + x[:, 3] / 2)
|
||||
y[:, 3] = (x[:, 2] + x[:, 4] / 2)
|
||||
y = torch.zeros(x.shape) if x.dtype is torch.float32 else np.zeros(x.shape)
|
||||
y[:, 0] = (x[:, 0] - x[:, 2] / 2)
|
||||
y[:, 1] = (x[:, 1] - x[:, 3] / 2)
|
||||
y[:, 2] = (x[:, 0] + x[:, 2] / 2)
|
||||
y[:, 3] = (x[:, 1] + x[:, 3] / 2)
|
||||
return y
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user