NVIDIA / pix2pixHD

Synthesizing and manipulating 2048x1024 images with conditional GANs
https://tcwang0509.github.io/pix2pixHD/
Other
6.58k stars 1.38k forks source link

How to Train on 512 x 512 paired images? #164

Open MuhammadAsadJaved opened 4 years ago

MuhammadAsadJaved commented 4 years ago

Hi, I want to train pix2pixHD model to generate infrared images from visual images. I have paired images with same size i.e (visual image 1...n , infrared image 1....n with size 512 x 512 ) How i can train with this size ? my GPU memory is 12G.

My dataset contains 12880 visual images and corresponding 12880 infrared images.

go-wxf commented 4 years ago

Just set --resize_or_crop none will work

EvgenyKashin commented 4 years ago

You can use python train.py --name r512 --label_nc 0 --no_instance --loadSize 512

TryingZ commented 4 years ago

do you train your dataset, i have a problem about the size of the output image. My dataset is all 620x460 paired RGB images. when i test my dataset after train: python test.py --name XXX --label_nc 0 --no_instance --resize_or_crop none , the size of output image change to 624x464. Do you meet this problem?

go-wxf commented 4 years ago

The size of imge must be divisible by 32 after the preprocessing.

TryingZ commented 4 years ago

The size of imge must be divisible by 32 after the preprocessing. oh no, i forget it ...If i want to keep the size of image, i need change which parameters when train and test? if i just resize the output image, i do not kown it will change the quality of image or not. i am a newbee in DL, and thanks for your reply

rajnish93 commented 4 years ago

To train on 512 x 512 paired images TPU is required as GPU has memory limit. So reduce your image size.

IMAGE_SIZE = [192, 192] # any image size 192, 224, 331, 512 based on your GPU memory.
# 512 works for TPU as GPU has memory limit
# Decode Function
def decode_image(image_data):
       image = tf.image.decode_jpeg(image_data, channels=3)
       image = tf.cast(image, tf.float32) / 255.0  # convert image to floats in [0, 1] range
       image = tf.reshape(image, [*IMAGE_SIZE, 3]) # size needed for TRAINING
       return image

Still you get memory limit then reduce the size to 48 X 48 with low bach size