From be87bdbf3748020a9062fb9db7d37a7077c0d55a Mon Sep 17 00:00:00 2001 From: jmiranda-laplateforme <67475949+jmiranda-laplateforme@users.noreply.github.com> Date: Wed, 7 Jul 2021 15:56:40 +0200 Subject: [PATCH] Update common.py Fix inference from PIL source. --- models/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/common.py b/models/common.py index 6b8b4e4cb42f..f4b91da62250 100644 --- a/models/common.py +++ b/models/common.py @@ -255,7 +255,7 @@ def forward(self, imgs, size=640, augment=False, profile=False): im, f = Image.open(requests.get(im, stream=True).raw if im.startswith('http') else im), im im = np.asarray(exif_transpose(im)) elif isinstance(im, Image.Image): # PIL Image - im, f = np.asarray(exif_transpose(im)), getattr(im, 'filename') or f + im, f = np.asarray(exif_transpose(im)), getattr(im, 'filename', f) or f files.append(Path(f).with_suffix('.jpg').name) if im.shape[0] < 5: # image in CHW im = im.transpose((1, 2, 0)) # reverse dataloader .transpose(2, 0, 1)