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 auto-config num_classes in CLI side #2861

Merged
merged 5 commits into from
Feb 1, 2024
Merged

Add auto-config num_classes in CLI side #2861

merged 5 commits into from
Feb 1, 2024

Conversation

harimkang
Copy link
Contributor

@harimkang harimkang commented Feb 1, 2024

Summary

  • Add the ability to automatically update the model.num_classes in the CLI to match the datamodule.
  • Instantiate the model separately in the CLI.
  • Add the --no-update-num-classes argument to disable the feature if needed.

Before: model.num_classes was a required element.

otx train --config <CONFIG> --data_root <DATASET> --model.num_classes <NUM_CLASSES>

After: don't need to update model.num_classes separately.

otx train --config <CONFIG> --data_root <DATASET>
>>> UserWarning: The `num_classes` in dataset is 2 but, the `num_classes` of model is 1000. So, Update `model.num_classes` to 2.

How to test

Checklist

  • I have added unit tests to cover my changes.​
  • I have added integration tests to cover my changes.​
  • I have added e2e tests for validation.
  • I have added the description of my changes into CHANGELOG in my target branch (e.g., CHANGELOG in develop).​
  • I have updated the documentation in my target branch accordingly (e.g., documentation in develop).
  • I have linked related issues.

License

  • I submit my code changes under the same Apache License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below).
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

@github-actions github-actions bot added TEST Any changes in tests OTX 2.0 labels Feb 1, 2024
src/otx/cli/cli.py Outdated Show resolved Hide resolved
@harimkang harimkang merged commit 6e94ff1 into openvinotoolkit:v2 Feb 1, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TEST Any changes in tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants