Browse Source

add load_cache functino in dataset

yjh0410 2 năm trước cách đây
mục cha
commit
bb472aa121
4 tập tin đã thay đổi với 5 bổ sung3 xóa
  1. 1 1
      dataset/coco.py
  2. 1 1
      dataset/ourdataset.py
  3. 1 1
      dataset/voc.py
  4. 2 0
      train.py

+ 1 - 1
dataset/coco.py

@@ -112,7 +112,7 @@ class COCODataset(Dataset):
             orig_h, orig_w, _ = image.shape
 
             # resize image
-            r = args.img_size / max(orig_h, orig_w)
+            r = self.img_size / max(orig_h, orig_w)
             if r != 1: 
                 interp = cv2.INTER_LINEAR
                 new_size = (int(orig_w * r), int(orig_h * r))

+ 1 - 1
dataset/ourdataset.py

@@ -95,7 +95,7 @@ class OurDataset(Dataset):
             orig_h, orig_w, _ = image.shape
 
             # resize image
-            r = args.img_size / max(orig_h, orig_w)
+            r = self.img_size / max(orig_h, orig_w)
             if r != 1: 
                 interp = cv2.INTER_LINEAR
                 new_size = (int(orig_w * r), int(orig_h * r))

+ 1 - 1
dataset/voc.py

@@ -153,7 +153,7 @@ class VOCDetection(data.Dataset):
             orig_h, orig_w, _ = image.shape
 
             # resize image
-            r = args.img_size / max(orig_h, orig_w)
+            r = self.img_size / max(orig_h, orig_w)
             if r != 1: 
                 interp = cv2.INTER_LINEAR
                 new_size = (int(orig_w * r), int(orig_h * r))

+ 2 - 0
train.py

@@ -77,6 +77,8 @@ def parse_args():
                         help='data root')
     parser.add_argument('-d', '--dataset', default='coco',
                         help='coco, voc, widerface, crowdhuman')
+    parser.add_argument('--load_cache', action='store_true', default=False,
+                        help='load data into memory.')
     
     # Train trick
     parser.add_argument('-ms', '--multi_scale', action='store_true', default=False,