alexlee-gk / lpips-tensorflow

Tensorflow port for the Learned Perceptual Image Patch Similarity (LPIPS) metric.
BSD 2-Clause "Simplified" License
130 stars 30 forks source link

lpips fails when when used with one channel images #5

Open agniszczotka opened 5 years ago

agniszczotka commented 5 years ago

ValueError: Dimension size must be evenly divisible by 3 but is 1 Number of ways to split should evenly divide the split dimension for 'import/split_1' (op: 'Split') with input shapes: [], [?,?,?,1] and with computed input tensors: input[0] = <-1>.

crrrr30 commented 4 years ago

I believe all ImageNet pretrained models accept only 3-channel inputs. I suggest copying the channels as follows:

Given x, a tensor of rank 4, of one channel

x = tf.tile(x, [1, 1, 1, 3])