Skip to content

add mask to loss#1

Merged
piercus merged 4 commits intopiercus:multi-taskfrom
marouaneamz:add_mask_loss
Oct 18, 2022
Merged

add mask to loss#1
piercus merged 4 commits intopiercus:multi-taskfrom
marouaneamz:add_mask_loss

Conversation

@marouaneamz
Copy link
Copy Markdown

this pull request adds option of the mask to the loss which allows not to take into account images in the loss if they do not have labels for certain task

Copy link
Copy Markdown
Owner

@piercus piercus left a comment

Choose a reason for hiding this comment

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

@marouaneamz please see inline comments

@marouaneamz
Copy link
Copy Markdown
Author

marouaneamz commented Oct 12, 2022

I try to adapt the pipeline if there is no mask , but I can't do your method because we add the labels with the first if (if we haven't hardcoded the tasks here ), and in this block we add the labels and the maks we go through the whole results list and not all of them at once

Comment on lines +86 to +92
for k, v in results.items():
if k.endswith('_img_label'):
task = k[:-10]
gt_label[task] = to_tensor(v)
elif k.endswith('_mask'):
task = k[:-5]
gt_mask[task] = v
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
for k, v in results.items():
if k.endswith('_img_label'):
task = k[:-10]
gt_label[task] = to_tensor(v)
elif k.endswith('_mask'):
task = k[:-5]
gt_mask[task] = v
for k, v in results.items():
if k.endswith('_img_label'):
task = k[:-10]
if task not in gt_label:
gt_label[task] = dict()
gt_label[task]['label'] = to_tensor(v)
elif k.endswith('_mask'):
task = k[:-5]
if task not in gt_label:
gt_label[task] = dict()
gt_label[task]['mask'] = v

@piercus piercus merged commit 8784684 into piercus:multi-task Oct 18, 2022
@marouaneamz marouaneamz deleted the add_mask_loss branch January 13, 2023 23:44
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.

2 participants