diffusion_policy icon indicating copy to clipboard operation
diffusion_policy copied to clipboard

Incorrect Image Normalization

Open Yingdong-Hu opened this issue 1 year ago • 1 comments

Hi @cheng-chi, this work is incredible! I read the code carefully and I have a doubt about image normalization. For example, in real_pusht_image_dataset.py, the following code normalizes the image to [-1, 1]

for key in self.rgb_keys:
    normalizer[key] = get_image_range_normalizer()
return normalizer

In multi_image_obs_encoder.py, ImageNet statistics are also used in the code, but this requires the image to be between [0, 1]

if imagenet_norm:
    this_normalizer = torchvision.transforms.Normalize(
        mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])

I don’t know what the impact of this bug is on the final performance, but it may be that there is something wrong with my understanding.

Yingdong-Hu avatar Jan 09 '24 13:01 Yingdong-Hu

Agree. I think its a bug, and values should be [-1,1] only when: imagenet_norm=False

saeeddaily avatar Jun 09 '24 14:06 saeeddaily