Want to add a CNN block in between but getting dimension error

Given groups=1, weight of size 1024 512 1 1, expected input[4, 1024, 8, 16] to have 512 channels, but got 1024 channels instead

!

Please let me know where I am doing the mistake.

As the error message explains, your conv layer takes 512 input channels, while your activation has 1024.
You could set in_channels=1024 in this particular conv layer to solve this issue.

Thanks @ptrblck , it has been resolved now…

I am facing one more problem… I want to use cross-entropy for semantic segmentation and the dimension of my target [4,3,200,200] and output [4,8,200,200]. giving me an error. 8 represent the number of classes for classification. Because if I am using the same network with output_dim =1 for MSE it is giving me the output. but for semantic, I am getting errors.

Do I need to convert my masked or labeled image into gray scale and then give color code or directly i can feed my masked RGB image (NYUv2 dataset). Please @ptrblck solve this.

If your target is an RGB image containing the color map, you would have to map it to class indices first.
I’m not familiar with the NYUv2 dataset, but maybe you’ll find some conversion between color codes to class indices.
If you can’t find it, you could create it by yourself using a dict.

ohh I think that is why error is coming!!