File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 30
30
31
31
32
32
class MultiScaleDataset (Dataset ):
33
+ """MultiScaleDataset
34
+
35
+ Args:
36
+ image_root (str): image root
37
+ cls_label_path (str): path to annotation file `train_list.txt` or `val_list.txt`
38
+ transform_ops (list, optional): list of transform op(s). Defaults to None.
39
+ delimiter (str, optional): delimiter. Defaults to None.
40
+ """
41
+
33
42
def __init__ (
34
43
self ,
35
44
image_root ,
36
45
cls_label_path ,
37
- transform_ops = None , ):
46
+ transform_ops = None ,
47
+ delimiter = None , ):
38
48
self ._img_root = image_root
39
49
self ._cls_path = cls_label_path
40
50
self .transform_ops = transform_ops
51
+ self .delimiter = delimiter if delimiter is not None else " "
41
52
self .images = []
42
53
self .labels = []
43
54
self ._load_anno ()
@@ -54,7 +65,7 @@ def _load_anno(self, seed=None):
54
65
if seed is not None :
55
66
np .random .RandomState (seed ).shuffle (lines )
56
67
for l in lines :
57
- l = l .strip ().split (" " )
68
+ l = l .strip ().split (self . delimiter )
58
69
self .images .append (os .path .join (self ._img_root , l [0 ]))
59
70
self .labels .append (np .int64 (l [1 ]))
60
71
assert os .path .exists (self .images [- 1 ])
You can’t perform that action at this time.
0 commit comments