From bb80db54b7141f0250eb1f874e8c9109a203aff4 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 20 Jul 2019 18:31:58 +0200 Subject: [PATCH] updates --- utils/datasets.py | 26 ++++++++++++++------------ utils/gcp.sh | 4 ++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/utils/datasets.py b/utils/datasets.py index be847bf7..912736f0 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -177,18 +177,20 @@ class LoadImagesAndLabels(Dataset): # for training/testing # Rectangular Training https://github.com/ultralytics/yolov3/issues/232 if self.rect: # Read image shapes - sp = 'data' + os.sep + path.replace('.txt', '.shapes').split(os.sep)[-1] # shapefile path - if not os.path.exists(sp): # read shapes using PIL and write shapefile for next time (faster) - s = [exif_size(Image.open(f)) for f in tqdm(self.img_files, desc='Reading image shapes')] - np.savetxt(sp, s, fmt='%g') - - try: - with open(sp, 'r') as f: # read existing shapefile - s = np.array([x.split() for x in f.read().splitlines()], dtype=np.float64) - assert len(s) == n, 'Shapefile out of sync' - except: - os.remove(sp) - print('Shapefile deleted: %s. Please rerun again.' % sp) + s = np.array([exif_size(Image.open(f)) for f in tqdm(self.img_files, desc='Reading image shapes')], + dtype=np.float64) + # sp = 'data' + os.sep + path.replace('.txt', '.shapes').split(os.sep)[-1] # shapefile path + # if not os.path.exists(sp): # read shapes using PIL and write shapefile for next time (faster) + # s = [exif_size(Image.open(f)) for f in tqdm(self.img_files, desc='Reading image shapes')] + # np.savetxt(sp, s, fmt='%g') + # + # try: + # with open(sp, 'r') as f: # read existing shapefile + # s = np.array([x.split() for x in f.read().splitlines()], dtype=np.float64) + # assert len(s) == n, 'Shapefile out of sync' + # except: + # os.remove(sp) + # print('Shapefile deleted: %s. Please rerun again.' % sp) # Sort by aspect ratio ar = s[:, 1] / s[:, 0] # aspect ratio diff --git a/utils/gcp.sh b/utils/gcp.sh index 0379a479..3279b6f8 100755 --- a/utils/gcp.sh +++ b/utils/gcp.sh @@ -3,10 +3,10 @@ # New VM rm -rf yolov3 weights coco git clone https://github.com/ultralytics/yolov3 -git clone https://github.com/cocodataset/cocoapi && cd cocoapi/PythonAPI && make && cd ../.. && cp -r cocoapi/PythonAPI/pycocotools yolov3 +# git clone https://github.com/cocodataset/cocoapi && cd cocoapi/PythonAPI && make && cd ../.. && cp -r cocoapi/PythonAPI/pycocotools yolov3 git clone https://github.com/NVIDIA/apex && cd apex && pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" . --user && cd .. && rm -rf apex bash yolov3/weights/download_yolov3_weights.sh && cp -r weights yolov3 -bash yolov3/data/get_coco_dataset.sh +bash yolov3/data/get_coco_dataset_gdrive.sh sudo shutdown # Re-clone