@@ -78,7 +78,11 @@ def is_valid_image_file(fname, img_extensions, gt_extensions):
7878 ----------
7979 fname : str
8080 filename of image path
81- Returns
81+ img_extensions : list
82+ list of valid image file extensions
83+ gt_extensions : list
84+ list of valid gt file extensions
85+ Returns
8286 -------
8387 bool
8488 is valid data sample
@@ -148,7 +152,7 @@ class LoadSample:
148152 def __init__ (self ,
149153 sample_ext : dict ,
150154 sample_fn : collections .abc .Callable ,
151- dtype = {} , normalize = (), norm_fn = norm_range ('-1,1' ),
155+ dtype = None , normalize = (), norm_fn = norm_range ('-1,1' ),
152156 ** kwargs ):
153157 """
154158
@@ -185,6 +189,8 @@ def __init__(self,
185189 >>> 'seg': 'uint8'},
186190 >>> normalize=('data',))
187191 """
192+ if dtype is None :
193+ dtype = {}
188194 self ._sample_ext = sample_ext
189195 self ._sample_fn = sample_fn
190196 self ._dtype = dtype
@@ -235,7 +241,7 @@ def __init__(self,
235241 sample_fn : collections .abc .Callable ,
236242 label_ext : collections .abc .Iterable ,
237243 label_fn : collections .abc .Callable ,
238- sample_kwargs = {} , ** kwargs ):
244+ sample_kwargs = None , ** kwargs ):
239245 """
240246 Load sample and label from folder
241247
@@ -264,6 +270,9 @@ def __init__(self,
264270 --------
265271 :class: `LoadSample`
266272 """
273+ if sample_kwargs is None :
274+ sample_kwargs = {}
275+
267276 super ().__init__ (sample_ext , sample_fn , ** sample_kwargs )
268277 self ._label_ext = label_ext
269278 self ._label_fn = label_fn
@@ -282,7 +291,7 @@ def __call__(self, path):
282291 dict
283292 dict with data and label
284293 """
285- sample_dict = super (LoadSampleLabel , self ).__call__ (path )
294+ sample_dict = super ().__call__ (path )
286295 label_dict = self ._label_fn (os .path .join (path , self ._label_ext ),
287296 ** self ._label_kwargs )
288297 sample_dict .update (label_dict )
0 commit comments