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

[BUGFIX] Use Path.is_dir instead of Path.suffix == "" #919

Merged
merged 2 commits into from
Mar 1, 2023

Conversation

strelka145
Copy link
Contributor

Description

The original code only determines what the path points to based on the presence or absence of the extension. With this, if you specify a directory name that includes "." in the output option, it will be mistaken for a file name. As a result, when visualizer.save was executed in anomalib/tools/inference/torch_inference.py, an error would occur or the file name would not be output as expected.
This fix corrects this bug by using .is_dir() to determine what the path points to.

Changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which refactors the code base)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • My code follows the pre-commit style and check guidelines of this project.
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • I have added a summary of my changes to the CHANGELOG (not for minor changes, docs and tests).

The method of determining whether a path points to a file or a directory by the presence or absence of a file extension has been changed to the method of determining by .is_dir().
@github-actions github-actions bot added the Data label Feb 18, 2023
@samet-akcay samet-akcay changed the title bug fix [BUGFIX] Use Path.is_dir instead of Path.suffix == "" Feb 20, 2023
@samet-akcay
Copy link
Contributor

@strelka145, thanks for the PR. Your proposal makes sense; however, there are number of tests that fail after this change. We need to sort these out to be able to merge your PR.

@strelka145
Copy link
Contributor Author

This PR(#924) fails in exactly the same way even though he only changed the README. Is this test working correctly?

@samet-akcay
Copy link
Contributor

Ah, it is the kornia package. Their recent version broke anomalib. We need to use the previous version for now.. See the details here. #920

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 for your contribution and patience for this PR to be merged!

@codecov
Copy link

codecov bot commented Mar 1, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (72f3af1) 86.77% compared to head (11dcad8) 86.77%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #919   +/-   ##
=======================================
  Coverage   86.77%   86.77%           
=======================================
  Files         165      165           
  Lines        6319     6319           
=======================================
  Hits         5483     5483           
  Misses        836      836           
Impacted Files Coverage Δ
anomalib/data/utils/image.py 52.45% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@samet-akcay samet-akcay merged commit 98a759e into openvinotoolkit:main Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants