fix bug when img-ins-seg pipeline input is Image.Image or numpy.ndarray

This commit is contained in:
hejunjie.hjj
2022-08-02 21:12:41 +08:00
parent 7d348b9ae8
commit 7d87d8213d

View File

@@ -79,15 +79,19 @@ class LoadImageFromFile:
dict: The dict contains loaded image and meta information.
"""
if results['img_prefix'] is not None:
filename = osp.join(results['img_prefix'],
results['img_info']['filename'])
else:
if 'img' in results and isinstance(results['img'], np.ndarray):
img = results['img']
filename = results['img_info']['filename']
else:
if results['img_prefix'] is not None:
filename = osp.join(results['img_prefix'],
results['img_info']['filename'])
else:
filename = results['img_info']['filename']
img_bytes = File.read(filename)
img_bytes = File.read(filename)
img = self.imfrombytes(img_bytes, 'color', 'bgr', backend='pillow')
img = self.imfrombytes(img_bytes, 'color', 'bgr', backend='pillow')
if self.to_float32:
img = img.astype(np.float32)