MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / get_imglist

Function get_imglist

examples/ImageNetModels/imagenet_utils.py:126–148  ·  view source on GitHub ↗

Returns: [(full filename, label)]

(dir, name)

Source from the content-addressed store, hash-verified

124 """
125
126 def get_imglist(dir, name):
127 """
128 Returns:
129 [(full filename, label)]
130 """
131 dir = os.path.join(dir, name)
132 meta = dataset.ILSVRCMeta()
133 imglist = meta.get_image_list(
134 name,
135 dataset.ILSVRCMeta.guess_dir_structure(dir))
136
137 def _filter(fname):
138 # png
139 return 'n02105855_2933.JPEG' in fname
140
141 ret = []
142 for fname, label in imglist:
143 if _filter(fname):
144 logger.info("Image {} was filtered out.".format(fname))
145 continue
146 fname = os.path.join(dir, fname)
147 ret.append((fname, label))
148 return ret
149
150 assert name in ['train', 'val', 'test']
151 assert datadir is not None

Callers 1

get_imagenet_tfdataFunction · 0.70

Calls 6

get_image_listMethod · 0.95
joinMethod · 0.80
guess_dir_structureMethod · 0.80
formatMethod · 0.80
appendMethod · 0.80
_filterFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…