-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
Draw mask callback #999
Draw mask callback #999
Conversation
I get a fail with "ModuleNotFoundError: No module named 'skimage'" , but I see it in the requirements. So I don't understand a problem |
Hello @Dokholyan! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-12-10 18:03:57 UTC |
elif activation == "Softmax2d": | ||
self.activation = torch.nn.Softmax2d() | ||
else: | ||
self.activation = lambda x: x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How you feel about replacing lambda with torch.nn.Identity
?
def _draw_masks( | ||
self, | ||
writer: SummaryWriter, | ||
image_over_predicted_mask: np.array, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use np.ndarray
self, | ||
writer: SummaryWriter, | ||
image_over_predicted_mask: np.array, | ||
image_over_gt_mask: Optional[np.array], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to set the default value to None
?
pred_mask_key: str, | ||
image_key: Optional[str] = None, | ||
gt_mask_key: Optional[str] = None, | ||
mask2show: Optional[List[int]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tuples can also be used, so it is better to use Optional[Iterable[int]]
here
if self.step % self.summary_step == 0: | ||
pred_mask = runner.output[self.pred_mask_key][0] | ||
pred_mask = self.activation(pred_mask) | ||
pred_mask = pred_mask.cpu().detach().numpy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use utils.detach
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please
- add your callback to the docs here https://github.com/catalyst-team/catalyst/blob/master/docs/api/contrib.rst
- add changelog
- merge correctly with master
- add tests?
Pull request has been modified.
|
|
CHANGELOG.md
Outdated
@@ -10,7 +10,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). | |||
### Added | |||
|
|||
- ([#1002](https://github.com/catalyst-team/catalyst/pull/1002)) | |||
- a few docs | |||
- DrawMasksCallback ([#999](https://github.com/catalyst-team/catalyst/pull/999)) | |||
- a few docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong ordering :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
pred_mask_key: str, | ||
image_key: Optional[str] = None, | ||
gt_mask_key: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it correct, that
pred_mask_key
comes fromrunner.output
image_key
comes fromrunner.input
gt_mask_key
comes fromrunner.input
?
could we rename them into
- output_key (or maybe even output_logits_key)
- input_image_key
- input_mask_key
?
what do you think about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is correct. predicted mask(logits) we get from "runner.output", image(input) and gt_mask(target) we get from "runner.input". The names are all debatable, if you want other names, I can change them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please rename them?
it would be great if all our callbacks will follow the same naming
log_name: logging name. If you use several such "callbacks", they | ||
must have different logging names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need it? by default, we usually have tensorboard
logger already for each dataset
could you reuse it?
here is an example, https://github.com/catalyst-team/catalyst/blob/master/catalyst/contrib/callbacks/confusion_matrix_logger.py#L41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it is better to save images separately. Since they weigh a lot more than everything else, and sometimes there is a desire to remove them. Secondly, the log-name is the name in the Tensorboard, as a prefix for metrics
Pull request has been modified.
This pull request is now in conflicts. @Dokholyan, could you fix it? 🙏 |
pred_mask_key: str, | ||
image_key: Optional[str] = None, | ||
gt_mask_key: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please rename them?
it would be great if all our callbacks will follow the same naming
Pull request has been modified.
Hello guys, What do you think about splitting this callback into two different ones:
Currently I am starting to use Wandb and the part which corresponds to the image overlaying with mask seems to me quite useful, but without Tensorboard logging. I consider this could be huge improvement for the granularity. |
Before submitting
catalyst-make-codestyle && catalyst-check-codestyle
(pip install -U catalyst-codestyle
).make check-docs
?pytest .
?Description
Related Issue
Type of Change
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
PS