"tests/vscode:/vscode.git/clone" did not exist on "52c5a936ed834d4abd396dc69da630512a569b7b"
Commit e68c3d90 authored by Matthew Dawkins's avatar Matthew Dawkins Committed by Kai Chen
Browse files

Fix issues with default 'img_prefix' value set to None when training (#1497)

* Still work if no img_prefix specified

* Update default param to be empty string
parent c514be0d
......@@ -37,7 +37,7 @@ class CustomDataset(Dataset):
ann_file,
pipeline,
data_root=None,
img_prefix=None,
img_prefix='',
seg_prefix=None,
proposal_file=None,
test_mode=False):
......
......@@ -15,8 +15,11 @@ class LoadImageFromFile(object):
self.to_float32 = to_float32
def __call__(self, results):
filename = osp.join(results['img_prefix'],
results['img_info']['filename'])
if results['img_prefix'] is not None:
filename = osp.join(results['img_prefix'],
results['img_info']['filename'])
else:
filename = results['img_info']['filename']
img = mmcv.imread(filename)
if self.to_float32:
img = img.astype(np.float32)
......@@ -52,8 +55,11 @@ class LoadAnnotations(object):
ann_info = results['ann_info']
results['gt_bboxes'] = ann_info['bboxes']
if len(results['gt_bboxes']) == 0 and self.skip_img_without_anno:
file_path = osp.join(results['img_prefix'],
results['img_info']['filename'])
if results['img_prefix'] is not None:
file_path = osp.join(results['img_prefix'],
results['img_info']['filename'])
else:
file_path = results['img_info']['filename']
warnings.warn(
'Skip the image "{}" that has no valid gt bbox'.format(
file_path))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment