Fix empty paths while saving images with PIL bytes input (#16809)
Co-authored-by: Laughing-q <1185102784@qq.com> Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
3f341d5dd3
commit
df1c10f002
1 changed files with 2 additions and 1 deletions
|
|
@ -409,7 +409,8 @@ class LoadPilAndNumpy:
|
|||
"""Initialize PIL and Numpy Dataloader."""
|
||||
if not isinstance(im0, list):
|
||||
im0 = [im0]
|
||||
self.paths = [getattr(im, "filename", f"image{i}.jpg") for i, im in enumerate(im0)]
|
||||
# use `image{i}.jpg` when Image.filename returns an empty path.
|
||||
self.paths = [getattr(im, "filename", "") or f"image{i}.jpg" for i, im in enumerate(im0)]
|
||||
self.im0 = [self._single_check(im) for im in im0]
|
||||
self.mode = "image"
|
||||
self.bs = len(self.im0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue