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

Fix KeyError:'label' in classification folder dataset #175

Merged

Conversation

samet-akcay
Copy link
Contributor

Description

  • This hotfix proposes a fix to return label in folder dataset when classification task is chosen. Currently the folder dataset doesn't return label in classification, which ultimately causes a failed validation.

  • PR also bumps up the black version due to a version dependency, resulting in some changes in some modules.

  • Fixes Issues with heatmap scaling when training without masks #173

Changes

  • Bug fix (non-breaking change which fixes an issue)
  • 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

@alexriedel1
Copy link
Contributor

Hi,
do you think it would make sense to also visualize in case of classification, but then calling something like the add_label function?

def add_label(prediction: np.ndarray, scores: float, font: int = cv2.FONT_HERSHEY_PLAIN) -> np.ndarray:

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, looks good to me!

visualizer.add_image(image=vis_img, title="Segmentation Result")
self._add_images(visualizer, pl_module, Path(filename))
visualizer.close()
if isinstance(outputs, dict) and "mask" in outputs.keys():
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good if we could also visualize the results when no masks are not available, but we could address this separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly, similar to what @alexriedel1 proposed. A separate PR would address this

@samet-akcay
Copy link
Contributor Author

Hi @alexriedel1, yes, that would definitely make sense. I've created this PR as a hotfix to address this bug. Not sure if I have time to address the classification visualization issue today, but it's been on our list for a while. Perhaps, we could address that in a separate PR?

@samet-akcay samet-akcay merged commit c6fc4dd into development Mar 30, 2022
@samet-akcay samet-akcay deleted the fix/sa/label-issue-in-classification-folder-dataset branch March 30, 2022 11:04
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.

Issues with heatmap scaling when training without masks
3 participants