@@ -88,13 +88,29 @@ def __init__(self,
8888 self .proposal_file = osp .join (self .data_root ,
8989 self .proposal_file )
9090 # load annotations (and proposals)
91- with self .file_client .get_local_path (self .ann_file ) as local_path :
92- self .data_infos = self .load_annotations (local_path )
91+ if hasattr (self .file_client , 'get_local_path' ):
92+ with self .file_client .get_local_path (self .ann_file ) as local_path :
93+ self .data_infos = self .load_annotations (local_path )
94+ else :
95+ warnings .warn (
96+ 'The used MMCV version does not have get_local_path. '
97+ f'We treat the { self .ann_file } as local paths and it '
98+ 'might cause errors if the path is not a local path. '
99+ 'Please use MMCV>= 1.3.16 if you meet errors.' )
100+ self .data_infos = self .load_annotations (self .ann_file )
93101
94102 if self .proposal_file is not None :
95- with self .file_client .get_local_path (
96- self .proposal_file ) as local_path :
97- self .proposals = self .load_proposals (local_path )
103+ if hasattr (self .file_client , 'get_local_path' ):
104+ with self .file_client .get_local_path (
105+ self .proposal_file ) as local_path :
106+ self .proposals = self .load_proposals (local_path )
107+ else :
108+ warnings .warn (
109+ 'The used MMCV version does not have get_local_path. '
110+ f'We treat the { self .ann_file } as local paths and it '
111+ 'might cause errors if the path is not a local path. '
112+ 'Please use MMCV>= 1.3.16 if you meet errors.' )
113+ self .proposals = self .load_proposals (self .proposal_file )
98114 else :
99115 self .proposals = None
100116
0 commit comments