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

[Custom loops PoC] Extend compatibility to tests #1032

Conversation

ashwinvaidya17
Copy link
Collaborator

Description

  • Extends compatibility to tests.

@github-actions github-actions bot added the Setup label May 12, 2023
@ashwinvaidya17 ashwinvaidya17 marked this pull request as ready for review May 17, 2023 13:53
Copy link
Contributor

@samet-akcay samet-akcay left a comment

Choose a reason for hiding this comment

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

Thanks, just two comments.



def get_metadata(task: TaskType, transform: dict[str, Any], model: AnomalyModule) -> dict[str, Any]:
def get_metadata(trainer: AnomalibTrainer, transform: dict[str, Any]) -> dict[str, Any]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe for another PR, but I was wondering if it were possible to access the transform from trainer? For example, to get the training transforms,

>>> trainer.datamodule.train_data.transform.to_dict()
{'__version__': '1.3.0', 'transform': {'__class_fullname__': 'Compose', 'p': 1.0, 'transforms': [...], 'bbox_params': None, 'keypoint_params': None, 'additional_targets': {...}}}

For the test transforms:

>>> trainer.datamodule.test_data.transform.to_dict()
{'__version__': '1.3.0', 'transform': {'__class_fullname__': 'Compose', 'p': 1.0, 'transforms': [...], 'bbox_params': None, 'keypoint_params': None, 'additional_targets': {...}}}

Comment on lines +74 to 81
if self.threshold_method == ThresholdMethod.ADAPTIVE:
if self.trainer.image_threshold is not None:
self.trainer.image_threshold.compute()
if self.trainer.task_type in (TaskType.SEGMENTATION, TaskType.DETECTION):
self.trainer.pixel_threshold.compute()
else:
self.trainer.pixel_threshold.value = self.trainer.image_threshold.value

Copy link
Contributor

Choose a reason for hiding this comment

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

This part will change with the thresholding refactor, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor

@samet-akcay samet-akcay left a comment

Choose a reason for hiding this comment

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

lgtm, thanks a lot!

Copy link
Contributor

@djdameln djdameln left a comment

Choose a reason for hiding this comment

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

Thanks!

@ashwinvaidya17 ashwinvaidya17 merged commit fa8fb87 into openvinotoolkit:feature/custom_loops May 30, 2023
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants