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
request for adding 4 bands-image training #8405
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/8405
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Hi @Floyd2yh! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
If image has 4 channels, doesn't mean we should load all 4 channels. It would be better if pil_loader takes optional parameter which indicates whether to return RGB only or PIL image without any conversion Because sometimes images have alpha channel (RGBA image) which are mostly constant value. In those cases, it's required to get rid of alpha channel. |
abhi-glitchhg, thank you for your advice. |
uploaded modified code |
I think we need to take a review/comments from maintainers in this approach. Maybe @pmeier or @NicolasHug ?? What do you guys think?? |
@@ -258,10 +258,13 @@ def __len__(self) -> int: | |||
|
|||
|
|||
def pil_loader(path: str) -> Image.Image: |
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 was suggesting something like this. This would be backward compatible as the default conversion is RGB. And in special cases where we want the conversation to other color space, (like RGBX) in your case we could handle that as well. Basically a more generalised solution.
def pil_loader(path: str) -> Image.Image: | |
def pil_loader(path: str, convert_to="RGB") -> Image.Image: |
abhi-glitchhg, ok I understood.
|
Thanks for the PR @Floyd2yh . The |
Aerial and satellite images taken with a drone are,typically in 4-band geotiff format.
A 4-band image is an RBGN image, which is a 3-band RGB plus near-infrared
(NIR) to the 3-band RGB.
This modification is needed to train the 4band-image without processing.