Skip to content

Unexpected behavior of enc_preprocess #10

@omayer

Description

@omayer

Hello,

Thank you for the paper, code and pretrained weights, it is great work!

I am confused by the output of enc_preprocess() in ModFlows_demo_batched.ipynb.

My understanding is that it should output a [3 x H x W] tensor of the preprocessed image, and my assumption is the "3" corresponds to the three color channels RGB.

However, when I try to visualize the output (in this case, the red channel), I get a scrambled image:

ff = '../../modflows/img/2.jpg'
x = enc_preprocess(Image.open(ff).resize((2000,2000)))
plt.imshow(x[0]) #plot red color channel 
Image

I believe this is due to the numpy reshape command being used in line 38 of ModFlows_demo_batched.ipynb: im = im.reshape(enc_shape) , which is scrambling the pixel-order. I think typically numpy transpose is used in this situation to change the dimension ordering, instead of reshape.

Is this expected behavior of the enc_preprocess, or am I doing something wrong, or possibly wrong dependencies? I checked on a few versions of numpy and it gives similar results.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions