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

Method guess_dir_structure

tensorpack/dataflow/dataset/ilsvrc.py:110–130  ·  view source on GitHub ↗

Return the directory structure of "dir". Args: dir(str): something like '/path/to/imagenet/val' Returns: either 'train' or 'original'

(dir)

Source from the content-addressed store, hash-verified

108
109 @staticmethod
110 def guess_dir_structure(dir):
111 """
112 Return the directory structure of "dir".
113
114 Args:
115 dir(str): something like '/path/to/imagenet/val'
116
117 Returns:
118 either 'train' or 'original'
119 """
120 subdir = os.listdir(dir)[0]
121 # find a subdir starting with 'n'
122 if subdir.startswith('n') and \
123 os.path.isdir(os.path.join(dir, subdir)):
124 dir_structure = 'train'
125 else:
126 dir_structure = 'original'
127 logger.info(
128 "[ILSVRC12] Assuming directory {} has '{}' structure.".format(
129 dir, dir_structure))
130 return dir_structure
131
132
133class ILSVRC12Files(RNGDataFlow):

Callers 5

__init__Method · 0.80
get_imglistFunction · 0.80
get_imglistFunction · 0.80
get_imglistFunction · 0.80
get_imglistFunction · 0.80

Calls 2

joinMethod · 0.80
formatMethod · 0.80

Tested by

no test coverage detected