junyanz / pytorch-CycleGAN-and-pix2pix

Image-to-Image Translation in PyTorch
Other
22.8k stars 6.29k forks source link

Is the Model Capable of Processing and Maintaining Consistent Output Sizes Across Varied Image Dimensions? #1633

Closed arrrrr3186 closed 6 months ago

arrrrr3186 commented 6 months ago

@junyanz @ssnl @AyushExel

So far i know, model can accept the any image size then implement the preprocess step.

can Model handle images of different sizes and generate outputs in the same size? For example, if I throw in a pic that's 256x256 and another that's 500x300, can the model keep the output sizes consistent?

Curious to know! Thanks a bunch!

arrrrr3186 commented 6 months ago

Hi there, anyone can help with this problem, it would be a great help to me.

ssnl commented 6 months ago

You can resize the input to the same size before feeding into the model.

arrrrr3186 commented 6 months ago

Thank you for response.

Simply resizing the input image won't address my issue. Let's say I resize an image to a standard size like 800x800 pixels. But what if your original input size is larger, like 1024x1024 pixels? In that case, resizing would change the dimensions to 800x800 pixels.

What I'm looking for is consistency in output size, regardless of the input image's dimensions. Whether it's 800x800, 1024x1024, or even 256x256 pixels, I want the output image to maintain the same dimensions as the input.

Do you know if there's a way to achieve this?

ssnl commented 6 months ago

What’s the problem with resizing to 800x800?

On Fri, Mar 15, 2024 at 02:36 arrrrr3186 @.***> wrote:

Thank you for response.

Simply resizing the input image won't address my issue. Let's say I resize an image to a standard size like 800x800 pixels. But what if your original input size is larger, like 1024x1024 pixels? In that case, resizing would change the dimensions to 800x800 pixels.

What I'm looking for is consistency in output size, regardless of the input image's dimensions. Whether it's 800x800, 1024x1024, or even 256x256 pixels, I want the output image to maintain the same dimensions as the input.

Do you know if there's a way to achieve this?

— Reply to this email directly, view it on GitHub https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/issues/1633#issuecomment-1999028958, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLJMZPEIFXV3SDJEOU5VGTYYKJF3AVCNFSM6AAAAABEQEDEAGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZGAZDQOJVHA . You are receiving this because you were mentioned.Message ID: @.***>

arrrrr3186 commented 6 months ago

Hi,

the problem with this is that, If I pass input image size 10241024, then the output will be 800800. but I want the output to be 1024*1024.

ssnl commented 6 months ago

Oh that's what you mean. It was ambiguous from your description.

The model is convolutional so it can probably take in any reasonably sized image and spit out a similarly sized (exact size would depend on strides and padding). However, the pretrained model are not trained on other sizes so no performance guarantees.

You can modify the code to train new models on arbitrarily sized data. We make no promises on how well it works.