MCPcopy Create free account
hub / github.com/tensorflow/datasets / _get_names

Function _get_names

tensorflow_datasets/image_classification/omniglot.py:146–160  ·  view source on GitHub ↗

Get alphabet and label names, union across all dirs.

(dirs)

Source from the content-addressed store, hash-verified

144
145
146def _get_names(dirs):
147 """Get alphabet and label names, union across all dirs."""
148 alphabets = set()
149 label_names = {}
150 for d in dirs:
151 for example in _walk_omniglot_dir(d):
152 alphabet, alphabet_char_id, label, _, _ = example
153 alphabets.add(alphabet)
154 label_name = "%s_%d" % (alphabet, alphabet_char_id)
155 if label in label_names:
156 assert label_names[label] == label_name
157 else:
158 label_names[label] = label_name
159 label_names = [label_names[k] for k in sorted(label_names)]
160 return alphabets, label_names

Callers 1

_split_generatorsMethod · 0.85

Calls 2

_walk_omniglot_dirFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected