-
Notifications
You must be signed in to change notification settings - Fork 86
Fix output image results in Semantic Segmentation task from run.py #889
Fix output image results in Semantic Segmentation task from run.py #889
Conversation
This PR needs Approvals as follows.
Please choose reviewers and requet reviews! Click to see how to approve each reviewsYou can approve this PR by triggered comments as follows.
See all trigger commentsPlease replace [Target] to review target
|
img = img.convert("L") | ||
img = np.zeros(label.shape[:2], dtype=np.uint8) | ||
img[label == i] = 255 | ||
img = PIL.Image.fromarray(img, mode="L").convert('1') |
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.
@oatawa1
Sorry, I don't understand why this diff solve the problem
Can you teach me?
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.
The new commit assigns each pixel color by the predicted class (the highest probability from softmax), Thus, it can be seen as assign 255 to the pixel that belongs to that class.
$ \sum_{\for i=class_no}{max(p_i) * 255} $
While each pixel in the old commit is a combination of each class based on softmax probability.
$ \sum_{\for i=class_no}{p_i * 255} & sum(p_i) = 1.0 $
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.
Ownership Approval
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.
Readability Approval
/ready |
⏳Merge job is queued... |
What this patch does to fix the issue.
Resolve the broken output image in Semantic Segmentation task from
run.py
Link to any relevant issues or pull requests.
#886 #830