MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / __init__

Method __init__

tensorpack/dataflow/dataset/ilsvrc.py:139–165  ·  view source on GitHub ↗

Same as in :class:`ILSVRC12`.

(self, dir, name, meta_dir=None,
                 shuffle=None, dir_structure=None)

Source from the content-addressed store, hash-verified

137 decode it in smarter ways (e.g. in parallel).
138 """
139 def __init__(self, dir, name, meta_dir=None,
140 shuffle=None, dir_structure=None):
141 """
142 Same as in :class:`ILSVRC12`.
143 """
144 assert name in ['train', 'test', 'val'], name
145 dir = os.path.expanduser(dir)
146 assert os.path.isdir(dir), dir
147 self.full_dir = os.path.join(dir, name)
148 self.name = name
149 assert os.path.isdir(self.full_dir), self.full_dir
150 assert meta_dir is None or os.path.isdir(meta_dir), meta_dir
151 if shuffle is None:
152 shuffle = name == 'train'
153 self.shuffle = shuffle
154
155 if name == 'train':
156 dir_structure = 'train'
157 if dir_structure is None:
158 dir_structure = ILSVRCMeta.guess_dir_structure(self.full_dir)
159
160 meta = ILSVRCMeta(meta_dir)
161 self.imglist = meta.get_image_list(name, dir_structure)
162
163 for fname, _ in self.imglist[:10]:
164 fname = os.path.join(self.full_dir, fname)
165 assert os.path.isfile(fname), fname
166
167 def __len__(self):
168 return len(self.imglist)

Callers

nothing calls this directly

Calls 4

get_image_listMethod · 0.95
ILSVRCMetaClass · 0.85
joinMethod · 0.80
guess_dir_structureMethod · 0.80

Tested by

no test coverage detected