Skip to content

Commit

Permalink
Add warning when cache_ram works with classify (ultralytics#14650)
Browse files Browse the repository at this point in the history
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
3 people authored Jul 24, 2024
1 parent 1c351b5 commit 9df18ca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ultralytics/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ def __init__(self, root, args, augment=False, prefix=""):
self.samples = self.samples[: round(len(self.samples) * args.fraction)]
self.prefix = colorstr(f"{prefix}: ") if prefix else ""
self.cache_ram = args.cache is True or str(args.cache).lower() == "ram" # cache images into RAM
if self.cache_ram:
LOGGER.warning(
"WARNING ⚠️ Classification `cache_ram` training has known memory leak in "
"https://github.com/ultralytics/ultralytics/issues/9824, setting `cache_ram=False`."
)
self.cache_ram = False
self.cache_disk = str(args.cache).lower() == "disk" # cache images on hard drive as uncompressed *.npy files
self.samples = self.verify_images() # filter out bad images
self.samples = [list(x) + [Path(x[0]).with_suffix(".npy"), None] for x in self.samples] # file, index, npy, im
Expand Down

0 comments on commit 9df18ca

Please sign in to comment.