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

Override the class list via TaxonomyModelTF.from_config() #614

Closed

Conversation

IamJeffG
Copy link

@IamJeffG IamJeffG commented Feb 8, 2024

Context

Sometimes we deal with SavedModels (not built by us) where the class list is not in "labels.csv" but in some other file. In those cases, inference via the SDK's TaxonomyModelTF will fail because the number of shape of output logits does not match the class_list shape.

What I changed

This PR allows downstream users to override the TaxonomyModelTF.class_list when instantiating using the from_config factory method.

My downstream code uses it as follows:

    perch_cfg = ConfigDict()
    perch_cfg.model_path = model_path
    with open(model_path / "reef_label.csv", "r") as f:
        perch_cfg.class_list = namespace.ClassList.from_csv(f)

    model = TaxonomyModelTF.from_config(perch_cfg)

@sdenton4
Copy link
Collaborator

Thanks, Jeff!
This should be resolved more generally by #615

@IamJeffG IamJeffG closed this Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants