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

encouter messy augmented images when the image shape is not square #24

Open
silencelamb opened this issue May 24, 2020 · 0 comments
Open

Comments

@silencelamb
Copy link

silencelamb commented May 24, 2020

Hi, I encouter autoaugmented images below, and i locate the problem is caused by that the pic_array shape used in augmentations is in wrong oder and my image shape is not square.
image

s = pil_img.size
pic_array = (np.array(pil_img.getdata()).reshape((s[0], s[1], 4)) / 255.0)

  1. make it correct
    the size of PIL img is(width,height)
    the shape of np.array which can be converted to PIL img should by (height,width,c), so the right way is
    s = pil_img.size
    pic_array = (np.array(pil_img.getdata()).reshape((s[1], s[0], 4)) / 255.0)

  2. make it faster
    I find np.array(pil_img.getdata()).reshape() is really slow, the much faster way is np.array(pil_img)

  3. By the way, i have a question: why 'RGBA' format is used? Is 'RGBA' format image necessary? I checked the valued of 'A’ channel of my images are all 255.
    Thank you.

@silencelamb silencelamb changed the title pic_array shape used in augmentations is in wrong order, the augmented images are messy when the image shape is not square encouter messy augmented images when the image shape is not square May 24, 2020
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

1 participant