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

about the edge_lable #42

Open
jjkkqq opened this issue Nov 6, 2021 · 3 comments
Open

about the edge_lable #42

jjkkqq opened this issue Nov 6, 2021 · 3 comments

Comments

@jjkkqq
Copy link

jjkkqq commented Nov 6, 2021

when the net get the edge_lable :
edge[edge < 127.5] = 0.0
edge[edge >= 127.5] = 1.0

but i found that after filtering, most pixels become 0 like:
image
Will this affect the training?
thank you!

@xwjabc
Copy link
Owner

xwjabc commented Nov 9, 2021

Thank you for your question! Yes, the hard threshold could lead to discrete edge pixels. However, I think it won't matter much for the training procedure, since in HED, the edge prediction is treated as a dense prediction task: Assume we have 100x100 label map, which contains 10000 pixels. Even if we mark all edge pixels correctly, they still have a limited quantity compared with background pixels (e.g. 100 edge pixels and 9900 background pixels). In HED, weighted cross-entropy is used to balance the edge pixels and background pixels (coefficient of edge pixels vs. background pixels in loss: 9900 vs. 100). Thus, if we have half of the edge pixels marked correctly (e.g. 50 pixels), then we will have 9950 background pixels. The 50 false negatives has a very small proportion of 9950 background pixels, which won't have much contribution to the negative loss in the weighted cross-entropy loss.

@jjkkqq
Copy link
Author

jjkkqq commented Nov 20, 2021

I remove the code
edge[edge < 127.5] = 0.0
edge[edge >= 127.5] = 1.0
and let edge=edge/255 as the final gt to calculate loss
is that ok?

@xwjabc
Copy link
Owner

xwjabc commented Nov 22, 2021

I think it may work. You can compare the results before and after removing the code and see the change of performance.

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

No branches or pull requests

2 participants