HavenFeng / TRUST

Towards Racially Unbiased Skin Tone Estimation via Scene Disambiguation (ECCV2022)
Other
139 stars 13 forks source link

RuntimeError: Given groups=1, weight of size [64, 3, 7, 7], expected input[16, 4, 224, 224] to have 3 channels, but got 4 channels instead #1

Closed nashpan closed 2 years ago

nashpan commented 2 years ago

thanks to your great work, I just want to run this code,but I have met the problem, could you please help me to solve this, thanks !

Traceback (most recent call last):
  File "test.py", line 134, in <module>
UST/lib/model.py", line 234, in test
    scale_factors, normalized_sh_params, texcode, lightcode, albedo, ops, shape_images = self.encoding(images, scene_images)
  File "/home/pan/Documents/project/TRUST/lib/model.py", line 160, in encoding
    E_scene_light_pred = self.E_scene_light(scene_images)
  File "/home/pan/.conda/envs/deca-env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/pan/Documents/project/TRUST/lib/nets/enc_net.py", line 77, in forward
    features = self.encoder(inputs)
  File "/home/pan/.conda/envs/deca-env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/pan/Documents/project/TRUST/lib/nets/Resnet.py", line 66, in forward
    x = self.conv1(x)
  File "/home/pan/.conda/envs/deca-env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/pan/.conda/envs/deca-env/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 457, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/home/pan/.conda/envs/deca-env/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 454, in _conv_forward
    self.padding, self.dilation, self.groups)
RuntimeError: Given groups=1, weight of size [64, 3, 7, 7], expected input[16, 4, 224, 224] to have 3 channels, but got 4 channels instead
iabaldwin commented 2 years ago

@nashpan - this corresponds to the RGBA images in the FAIR dataset; the model expects RGB images. I have created a PR for this.

HavenFeng commented 2 years ago

@nashpan - this corresponds to the RGBA images in the FAIR dataset; the model expects RGB images. I have created a PR for this.

Good catch! The FAIR dataset gives out the rendered RGBA images, but the TRUST model is trained with processed RGB data. I've checked and merged your PR.