Fix single-image dataset failure mode (#11694)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
b6415e4ef9
commit
40e5ac34c9
2 changed files with 3 additions and 3 deletions
|
|
@ -170,7 +170,7 @@ class BaseDataset(Dataset):
|
|||
if self.augment:
|
||||
self.ims[i], self.im_hw0[i], self.im_hw[i] = im, (h0, w0), im.shape[:2] # im, hw_original, hw_resized
|
||||
self.buffer.append(i)
|
||||
if len(self.buffer) >= self.max_buffer_length:
|
||||
if 1 < len(self.buffer) >= self.max_buffer_length: # prevent empty buffer
|
||||
j = self.buffer.pop(0)
|
||||
if self.cache != "ram":
|
||||
self.ims[j], self.im_hw0[j], self.im_hw[j] = None, None, None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue