Skip to content

Commit

Permalink
Image Caching Disable ultralytics#2
Browse files Browse the repository at this point in the history
  • Loading branch information
manole-alexandru committed Mar 25, 2023
1 parent dfdbb2e commit 7c92d1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ def __getitem__(self, index):

def load_image(self, i):
# Loads 1 image from dataset index 'i', returns (im, original hw, resized hw)
im, f, fn, seg = self.ims[i], self.im_files[i], self.npy_files[i], self.segs[i]
im, f, fn, seg = self.ims[i], self.im_files[i], self.npy_files[i], None
if im is None: # not cached in RAM
if fn.exists(): # load npy
im = np.load(fn)
Expand All @@ -767,7 +767,7 @@ def load_image(self, i):
im = cv2.resize(im, (math.ceil(w0 * r), math.ceil(h0 * r)), interpolation=interp)
seg = cv2.resize(seg, (math.ceil(w0 * r), math.ceil(h0 * r)), interpolation=interp)
return im, (h0, w0), im.shape[:2], seg # im, hw_original, hw_resized
return self.ims[i], self.im_hw0[i], self.im_hw[i], self.segs[i] # im, hw_original, hw_resized
return self.ims[i], self.im_hw0[i], self.im_hw[i], seg # im, hw_original, hw_resized

def cache_images_to_disk(self, i):
# Saves an image as an *.npy file for faster loading
Expand Down

0 comments on commit 7c92d1e

Please sign in to comment.