pix2pix-tensorflow icon indicating copy to clipboard operation
pix2pix-tensorflow copied to clipboard

Change image loading for grayscale support

Open joschkazj opened this issue 7 years ago • 0 comments

I tried training the model for grayscale input and was having similar issues as mentioned in #12, setting input_c_dim=1 and output_c_dim=1 did not work for me

model = pix2pix(sess, image_size=args.fine_size, batch_size=args.batch_size,
                        output_size=args.fine_size, dataset_name=args.dataset_name,
                        checkpoint_dir=args.checkpoint_dir, sample_dir=args.sample_dir,
                        input_c_dim=1, output_c_dim=1)

After investigating the issue, I changed the image loading function which made the optional reshaping

if (self.is_grayscale):
    batch_images = np.array(batch).astype(np.float32)[:, :, :, None]
else:
    batch_images = np.array(batch).astype(np.float32)

obsolete.

joschkazj avatar Jan 29 '18 08:01 joschkazj