Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Fix output image results in Semantic Segmentation task from run.py #889

Merged
merged 5 commits into from
Mar 4, 2020
Merged

Fix output image results in Semantic Segmentation task from run.py #889

merged 5 commits into from
Mar 4, 2020

Conversation

oatawa1
Copy link
Contributor

@oatawa1 oatawa1 commented Mar 3, 2020

What this patch does to fix the issue.

Resolve the broken output image in Semantic Segmentation task from run.py

  • Before
    0006R0_f02040_x86
  • After
    0006R0_f02040

Link to any relevant issues or pull requests.

#886 #830

@oatawa1 oatawa1 requested a review from iizukak March 3, 2020 08:02
@blueoil-butler blueoil-butler bot added the CI: auto-run Run CI automatically label Mar 3, 2020
@bo-code-review-bot
Copy link

This PR needs Approvals as follows.

  • Ownership Approval for / from iizukak, tkng, ruimashita
  • Readability Approval for Python from tkng, tsawada

Please choose reviewers and requet reviews!

Click to see how to approve each reviews

You can approve this PR by triggered comments as follows.

  • Approve all reviews requested to you (readability and ownership) and LGTM review
    Approval, LGTM

  • Approve all ownership reviews
    Ownership Approval or OA

  • Approve all readability reviews
    Readability Approval or RA

  • Approve specified review targets

    • Example of Ownership Reviewer of /: Ownership Approval for / or OA for /
    • Example of Readability Reviewer of Python: Readability Approval for Python or RA for Python
  • Approve LGTM review
    LGTM

See all trigger comments

Please replace [Target] to review target

  • Ownership Approval
    • Ownership Approval for [Target]
    • OA for [Target]
    • Ownership Approval
    • OA
    • Approval
  • Readability Approval
    • Readability Approval for [Target]
    • RA for [Target]
    • [Target] Readability Approval
    • [Target] RA
    • Readability Approval
    • RA
    • Approval
  • LGTM
    • LGTM
    • lgtm

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')
Copy link
Member

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?

Copy link
Contributor Author

@oatawa1 oatawa1 Mar 3, 2020

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 $

@oatawa1 oatawa1 added the CI: test-lmnet Run lmnet test once label Mar 3, 2020
@blueoil-butler blueoil-butler bot removed the CI: test-lmnet Run lmnet test once label Mar 3, 2020
Copy link
Member

@iizukak iizukak left a comment

Choose a reason for hiding this comment

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

Ownership Approval

@iizukak iizukak requested a review from tsawada March 4, 2020 00:38
Copy link
Contributor

@tsawada tsawada left a comment

Choose a reason for hiding this comment

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

Readability Approval

@oatawa1
Copy link
Contributor Author

oatawa1 commented Mar 4, 2020

/ready

@bo-mergebot
Copy link
Contributor

bo-mergebot bot commented Mar 4, 2020

⏳Merge job is queued...

@bo-mergebot bo-mergebot bot merged commit 7013e63 into blue-oil:master Mar 4, 2020
@oatawa1 oatawa1 deleted the fix-segmentation-image-output branch March 4, 2020 02:05
@oatawa1 oatawa1 self-assigned this Jun 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI: auto-run Run CI automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants