diff --git a/utils/datasets.py b/utils/datasets.py index 6882f49b..33d89a68 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -144,14 +144,15 @@ class LoadImagesAndLabels(Dataset): # for training/testing for x in self.img_files] # Rectangular Training https://github.com/ultralytics/yolov3/issues/232 - self.train_rectangular = False + self.train_rectangular = True if self.train_rectangular: bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index - nb = bi[-1] # number of batches + nb = bi[-1] + 1 # number of batches from PIL import Image # Read image aspect ratios - s = np.array([Image.open(f).size for f in tqdm(self.img_files, desc='Reading image shapes')]) + iter = tqdm(self.img_files, desc='Reading image shapes') if n > 100 else self.img_files + s = np.array([Image.open(f).size for f in iter]) ar = s[:, 1] / s[:, 0] # aspect ratio # Sort by aspect ratio diff --git a/utils/gcp.sh b/utils/gcp.sh index 477264f2..a5ca261b 100755 --- a/utils/gcp.sh +++ b/utils/gcp.sh @@ -64,7 +64,7 @@ sudo shutdown rm -rf yolov3 git clone https://github.com/ultralytics/yolov3 # master cp -r cocoapi/PythonAPI/pycocotools yolov3 -cp -r weights yolov3 && cd yolov3 +cp -r weights yolov3 && cd yolov3 python3 detect.py # detect python3 test.py --data data/coco_32img.data # test python3 train.py --data data/coco_32img.data --epochs 4 --nosave # train