Skip to content

Commit

Permalink
Update setattr() default for Hub PIL images (ultralytics#3923)
Browse files Browse the repository at this point in the history
Fix inference from PIL source.
  • Loading branch information
jmiranda-laplateforme authored Jul 7, 2021
1 parent 3302d1f commit c58c699
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c58c699

Please sign in to comment.