Skip to content

Potential mismatching image/label paths and gray scale image related problems #12

Open

Description

@YuhuaBillChen

Hi Junho,

Really a great work and I was very happy to try out your implementation.

However, I notice a potential problem for the path name matching in the Image_data preprocess. Because the result list from glob is not sorted, the order from both image and segmap path lists might be consistent but in my case they are totally messed up. Therefore I changed the code into:

        self.image = sorted(glob(self.img_dataset_path + '/*.*'), key=os.path.basename)
        self.segmap = sorted(glob(self.segmap_dataset_path + '/*.*'), key=os.path.basename)
        self.segmap_test = sorted(glob(self.segmap_test_dataset_path + '/*.*'), key=os.path.basename)

The 2nd issue is that when using gray-scale image, the VGGLoss part raises error complaining shape mismatching. I modified the code in vgg19_keras.py, VGGLoss's call function:

        if x.shape[-1] == 1:
            x = tf.tile(x, [1, 1, 1, 3])
        if y.shape[-1] == 1:
            y = tf.tile(y, [1, 1, 1, 3])

Just repeat the single channel into 3 to resolve the shape problem.

The last one is in the sample imaging saving, simply add

    if img.shape[-1] == 1:
        img = img[..., 0]

after
https://github.com/taki0112/SPADE-Tensorflow/blob/master/utils.py#L208

Thank you again for your nice work, hope those lines would be helpful.

Best,
Yuhua (Bill)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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