[Fix] load error (#1207)

pull/1212/head
liukuikun 2022-07-26 10:48:10 +08:00 committed by GitHub
parent 0bf05b0ae9
commit bc043101fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -68,7 +68,7 @@ class LoadImageFromFile(MMCV_LoadImageFromFile):
results (dict): Result dict from :obj:``mmcv.BaseDataset``.
"""
results = super().transform(results)
if min(results['ori_shape']) < self.min_size:
if results and min(results['ori_shape']) < self.min_size:
return None
else:
return results

View File

@ -34,6 +34,11 @@ class TestLoadImageFromFile(TestCase):
results = transform(copy.deepcopy(results))
self.assertIsNone(results)
results = dict(img_path='fake.jpg')
transform = LoadImageFromFile(min_size=26, ignore_empty=True)
results = transform(copy.deepcopy(results))
self.assertIsNone(results)
class TestLoadOCRAnnotations(TestCase):