Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add labels that project was not initialized with #20

Open
abfleishman opened this issue Sep 10, 2018 · 2 comments
Open

add labels that project was not initialized with #20

abfleishman opened this issue Sep 10, 2018 · 2 comments
Labels
needs testing Workaround is provided, needs verification

Comments

@abfleishman
Copy link

Sometimes when tagging new labels that were not thought of when the project was initialized are needed. Essentially, it would be nice to be able to add classes to the config.ini and have the pascal_label_map update automatically with the new labels.

@yashpande provided this code
The code to make a new label map file:

with open(config_file["label_map_path"], "w") as map_file:
       for index, name in enumerate(config_file["classes"].split(","), 1):
           map_file.write("item {{\n  id: {}\n  name: '{}'\n}}".format(index, name))

The easiest way is probably just to manually fill in the variables config_file["label_map_path"] and config_file["classes"] then run it as an independent script.
You might want to add an issue about just having that code run each time training kicks off.

@yashpande
Copy link
Collaborator

yashpande commented Sep 10, 2018

@olgaliak The best place for this would likely be in convert_tf_record.py in line 73. Since config_file["classes"] is already a parameter (tag_names) you would simply also have to send the config_file["label_map_path"] parameter as label_map_path and then you could use the code:

with open(label_map_path, "w") as map_file:
    for index, name in enumerate(tag_names, 1):
        map_file.write("item {{\n  id: {}\n  name: '{}'\n}}".format(index, name))

@yashpande
Copy link
Collaborator

I added this in the yash/features branch. Please let me know if it works / throws errors 😃

@olgaliak olgaliak added the needs testing Workaround is provided, needs verification label Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs testing Workaround is provided, needs verification
Projects
None yet
Development

No branches or pull requests

3 participants