You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
try:
if Path(filename).suffix in ['.npy', '.npz']:
img = np.load(filename) # 问题:当读取的文件为npz格式时,包含了多项array数据,需要根据关键字进行指定
else:
if self.file_client_args is not None:
file_client = fileio.FileClient.infer_client(
self.file_client_args, filename)
img_bytes = file_client.get(filename)
else:
img_bytes = fileio.get(
filename, backend_args=self.backend_args)
img = mmcv.imfrombytes(
img_bytes,
flag=self.color_type,
backend=self.imdecode_backend)
except Exception as e:
if self.ignore_empty:
return None
else:
raise e
# in some cases, images are not read successfully, the img would be
# `None`, refer to https://github.com/open-mmlab/mmpretrain/issues/1427
assert img is not None, f'failed to load image: {filename}'
if self.to_float32:
img = img.astype(np.float32)
results['img'] = img
results['img_shape'] = img.shape[:2] # 在这里会报出错误,因为此时的img变量是一个包含多项array的npz数据
results['ori_shape'] = img.shape[:2]
return results
The text was updated successfully, but these errors were encountered:
从741行开始,如下
The text was updated successfully, but these errors were encountered: