Skip to content

Instantly share code, notes, and snippets.

@zakirangwala
Created December 1, 2020 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zakirangwala/cbbd9253493b40763b8e7e5fbbe4c11d to your computer and use it in GitHub Desktop.
Save zakirangwala/cbbd9253493b40763b8e7e5fbbe4c11d to your computer and use it in GitHub Desktop.
Create Label Map - Mask Detector
# Label Map
def construct_label_map():
labels = [{'name': 'Mask', 'id': 1}, {'name': 'NoMask', 'id': 2}]
with open(ANNOTATION_PATH + '\label_map.pbtxt', 'w') as f:
for label in labels:
f.write('item { \n')
f.write('\tname:\'{}\'\n'.format(label['name']))
f.write('\tid:{}\n'.format(label['id']))
f.write('}\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment