This commit is contained in:
Glenn Jocher 2019-04-29 17:57:51 +02:00
parent b1604be04c
commit 94f954eba0
2 changed files with 3 additions and 2 deletions

View File

@ -75,6 +75,7 @@ def detect(
det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round() det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round()
# Print results to screen # Print results to screen
print('%gx%g ' % img.shape[2:], end='') # print image size
for c in det[:, -1].unique(): for c in det[:, -1].unique():
n = (det[:, -1] == c).sum() n = (det[:, -1] == c).sum()
print('%g %ss' % (n, classes[int(c)]), end=', ') print('%g %ss' % (n, classes[int(c)]), end=', ')

View File

@ -75,7 +75,6 @@ class LoadImages: # for inference
# Padded resize # Padded resize
img, _, _, _ = letterbox(img0, new_shape=self.height) img, _, _, _ = letterbox(img0, new_shape=self.height)
print('%gx%g ' % img.shape[:2], end='') # print image size
# Normalize RGB # Normalize RGB
img = img[:, :, ::-1].transpose(2, 0, 1) # BGR to RGB img = img[:, :, ::-1].transpose(2, 0, 1) # BGR to RGB
@ -114,6 +113,7 @@ class LoadWebcam: # for inference
assert ret_val, 'Webcam Error' assert ret_val, 'Webcam Error'
img_path = 'webcam_%g.jpg' % self.count img_path = 'webcam_%g.jpg' % self.count
img0 = cv2.flip(img0, 1) # flip left-right img0 = cv2.flip(img0, 1) # flip left-right
print('webcam %g: ' % self.count, end='')
# Padded resize # Padded resize
img, _, _, _ = letterbox(img0, new_shape=self.height) img, _, _, _ = letterbox(img0, new_shape=self.height)
@ -144,7 +144,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
for x in self.img_files] for x in self.img_files]
# Rectangular Training https://github.com/ultralytics/yolov3/issues/232 # Rectangular Training https://github.com/ultralytics/yolov3/issues/232
self.train_rectangular = False self.train_rectangular = True
if self.train_rectangular: if self.train_rectangular:
bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index
nb = bi[-1] + 1 # number of batches nb = bi[-1] + 1 # number of batches