pix2pixHD error with own dataset
I am trying to generate my own images using the pix2pixHD pre-trained model. Github repo found here

The images inside the dataset has to be in grayscale with no alpha channel. The images in the repo has a size of 16 bitPerSample and I have both images in size 8 and 16 bitsPerSample.

When I check both my images and the images in the repo using sips -g all. This is the outcome I get:

pixelWidth: 2048
pixelHeight: 1024
typeIdentifier: public.png
format: png
formatOptions: default
dpiWidth: 72.000
dpiHeight: 72.000
samplesPerPixel: 1
bitsPerSample: 16
hasAlpha: no
space: Gray


The strange thing is that it works with the images that has 8 bitPerSample.
This is the outcome I get:

Grayscale input

Converted label map

Final output


When I run test.py with 16 bitsPerSample images, it doesn't work.
This is the error it gives me:

model [Pix2PixHDModel] was created
Traceback (most recent call last):
  File "test.py", line 26, in &lt;module&gt;
    for i, data in enumerate(dataset):
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 210, in __next__
    return self._process_next_batch(batch)
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 230, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
TypeError: Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 42, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 42, in &lt;listcomp&gt;
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/home/paperspace/Documents/pix2pixHD/data/aligned_dataset.py", line 41, in __getitem__
    label_tensor = transform_label(label) * 255.0
  File "/usr/local/lib/python3.5/dist-packages/torch/tensor.py", line 309, in __mul__
    return self.mul(other)
TypeError: mul received an invalid combination of arguments - got (float), but expected one of:
 * (int value)
      didn't match because some of the arguments have invalid types: (float)
 * (torch.IntTensor other)
      didn't match because some of the arguments have invalid types: (float)


I am new fairly to Tensorflow and I have never used pytorch before.

Any idea what this error mean and how can I resolve it?

Yes, I think I can help you. 
I haven't checked the repository, but from the error trace the problem appears to be following: 

You are performing a multiplication operation betweenn the output of transform_label(label) (presumably a tensor) and a scalar 255.0. This is fine as long as both your scalar and your tensor are of the same datatype. From the error trace however, it looks as if the output of transform_label() is of data type Int / Long, while 255.0 is a float. 

I suggest you try 255 or int(255.0) instead of 255.0. 

If this does not resolve your problem, let me know what data type the output of transform_label() is. 
