catch more specific errors

This commit is contained in:
Xintao
2021-11-24 00:14:05 +08:00
parent 35ee6f781e
commit 7dd860a881
4 changed files with 4 additions and 4 deletions

View File

@@ -92,7 +92,7 @@ class RealESRGANDataset(data.Dataset):
while retry > 0:
try:
img_bytes = self.file_client.get(gt_path, 'gt')
except Exception as e:
except (IOError, OSError) as e:
logger = get_root_logger()
logger.warn(f'File client error: {e}, remaining retry times: {retry - 1}')
# change another file to read

View File

@@ -128,7 +128,7 @@ class RealESRGANer():
try:
with torch.no_grad():
output_tile = self.model(input_tile)
except Exception as error:
except RuntimeError as error:
print('Error', error)
print(f'\tTile {tile_idx}/{tiles_x * tiles_y}')