Skip to content

Commit

Permalink
Image Caching Disable ultralytics#3
Browse files Browse the repository at this point in the history
  • Loading branch information
manole-alexandru committed Mar 25, 2023
1 parent 7c92d1e commit 03bec2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def check_cache_ram(self, safety_margin=0.1, prefix=''):
for _ in range(n):
im = cv2.imread(random.choice(self.im_files)) # sample image
ratio = self.img_size / max(im.shape[0], im.shape[1]) # max(h, w) # ratio
b += (im.nbytes * ratio ** 2) * 2 # ADDED *2 for mask - DELETE THIS IN CASE OF EMERGENCY
b += im.nbytes * ratio ** 2
mem_required = b * self.n / n # GB required to cache dataset into RAM
mem = psutil.virtual_memory()
cache = mem_required * (1 + safety_margin) < mem.available # to cache or not to cache, that is the question
Expand Down

0 comments on commit 03bec2b

Please sign in to comment.