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

Es/anomaly hpo save model bug fix #1315

Closed
wants to merge 4 commits into from

Conversation

eunwoosh
Copy link
Contributor

This PR solves bug that error raises when run HPO on anomaly tasks.
It's same with previous one but for OTX and Geti's develop branch.

@eunwoosh eunwoosh requested a review from a team as a code owner October 27, 2022 05:27
@github-actions github-actions bot added CLI Any changes in OTE CLI ALGO Any changes in OTX Algo Tasks implementation labels Oct 27, 2022
@eunwoosh
Copy link
Contributor Author

run ote-test

@eunwoosh eunwoosh force-pushed the es/anomaly_hpo_save_model_bug_fix branch from 4892b19 to ecc636b Compare November 9, 2022 08:49
@eunwoosh
Copy link
Contributor Author

eunwoosh commented Nov 9, 2022

run ote-test

@goodsong81
Copy link
Contributor

Could you run some local HPO tests for Anomaly tasks?

@eunwoosh
Copy link
Contributor Author

eunwoosh commented Nov 9, 2022

@ashwinvaidya17 This PR is same with [this PR](https://github.com/openvinotoolkit/training_extensions/pull/1300, but for develop branch.
I also reflect your bug fix PR.
Could you check that there is some problem in the implementation?

@eunwoosh
Copy link
Contributor Author

eunwoosh commented Nov 9, 2022

Could you run some local HPO tests for Anomaly tasks?

Ok I'm checking now.

Copy link
Contributor

@ashwinvaidya17 ashwinvaidya17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. But I think you need to update _set_metadata as well.

def _set_metadata(self, output_model: ModelEntity):
        if hasattr(self.model, "image_threshold"):
            output_model.set_data("image_threshold", self.model.image_threshold.value.cpu().numpy().tobytes())
        if hasattr(self.model, "pixel_threshold"):
            output_model.set_data("pixel_threshold", self.model.pixel_threshold.value.cpu().numpy().tobytes())
        if hasattr(self.model, "normalization_metrics"):
            output_model.set_data("min", self.model.normalization_metrics.state_dict()["min"].cpu().numpy().tobytes())
            output_model.set_data("max", self.model.normalization_metrics.state_dict()["max"].cpu().numpy().tobytes())
        else:
            logger.warning(
                "The model was not trained before saving. This will lead to incorrect normalization of the heatmaps."
            )

@eunwoosh
Copy link
Contributor Author

eunwoosh commented Nov 9, 2022

Could you run some local HPO tests for Anomaly tasks?

I checked that any errors didn't arise when run anomaly task with HPO.

@goodsong81
Copy link
Contributor

@ashwinvaidya17 Thank you for comment.
@eunwoosh But the changes are included in https://github.com/openvinotoolkit/training_extensions/pull/1337/files.
We don't need to replicate.

@eunwoosh
Copy link
Contributor Author

eunwoosh commented Nov 9, 2022

@ashwinvaidya17 Thank you for comment. @eunwoosh But the changes are included in https://github.com/openvinotoolkit/training_extensions/pull/1337/files. We don't need to replicate.

I see. then, I'll revert it.

@eunwoosh
Copy link
Contributor Author

eunwoosh commented Nov 9, 2022

run ote-test

@eunwoosh eunwoosh closed this Jan 26, 2023
@yunchu yunchu deleted the es/anomaly_hpo_save_model_bug_fix branch March 29, 2023 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ALGO Any changes in OTX Algo Tasks implementation CLI Any changes in OTE CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants