yuangpeng commited on
Commit
3f5e7de
·
1 Parent(s): f345d42

fix(coco): fix Nonetype error when evaluating (#1581)

Browse files
Files changed (1) hide show
  1. yolox/data/datasets/coco.py +3 -3
yolox/data/datasets/coco.py CHANGED
@@ -99,7 +99,7 @@ class COCODataset(Dataset):
99
  f"there is no guarantee that the remaining memory space is sufficient"
100
  )
101
 
102
- if self.cache and self.imgs is None:
103
  if self.cache_type == 'ram':
104
  self.imgs = [None] * self.num_imgs
105
  logger.info("You are using cached images in RAM to accelerate training!")
@@ -224,9 +224,9 @@ class COCODataset(Dataset):
224
  id_ = self.ids[index]
225
  label, origin_image_size, _, filename = self.annotations[index]
226
 
227
- if self.cache_type == 'ram':
228
  img = self.imgs[index]
229
- elif self.cache_type == 'disk':
230
  img = np.load(os.path.join(self.cache_dir, f"{filename.split('.')[0]}.npy"))
231
  else:
232
  img = self.load_resized_img(index)
 
99
  f"there is no guarantee that the remaining memory space is sufficient"
100
  )
101
 
102
+ if self.imgs is None:
103
  if self.cache_type == 'ram':
104
  self.imgs = [None] * self.num_imgs
105
  logger.info("You are using cached images in RAM to accelerate training!")
 
224
  id_ = self.ids[index]
225
  label, origin_image_size, _, filename = self.annotations[index]
226
 
227
+ if self.cache and self.cache_type == 'ram':
228
  img = self.imgs[index]
229
+ elif self.cache and self.cache_type == 'disk':
230
  img = np.load(os.path.join(self.cache_dir, f"{filename.split('.')[0]}.npy"))
231
  else:
232
  img = self.load_resized_img(index)