I am new to resnet models.

I want to implement a resnet50 model for semantic segmentation I am following the code from this video, but my numclasses is 21. I have a few questions:

  1. If i pass in any rgb jpeg image into the model, I get an output of size (1, 21). What does this output represent?

  2. Since I am doing semantic segmentation, my images dont have any rgb channels, so what should I put for image_channels in self.conv1?

  3. I pass in an image for training, attached below (this image has a label ranging from 0 - 20 for the object class). After the image passes through the resnet mode, and I get an output of something in the shape of (1, 21). What does this output represent?

enter image description here


1 Answer 1


The output from the ResNet model is a vector containing the probability that the image belongs to each of the n classes, in your case to any of the 21 classes. If you want to use the ResNet model for semantic segmentation you should use a different model structure since the model in the linked video is used for a different type of task (classification). When performing segmentation the model output should be of size (H, W, N_CLASSES) instead of (1, N_CLASSES) which is the case for the model from the video.

  • $\begingroup$ Is there any documentation or any link where i can learn about the model structure for semantic segmentation using resnet? I cant seem to find any thing online $\endgroup$ Commented Nov 24, 2021 at 16:20
  • $\begingroup$ This github repository contains an example where the ResNet architecture is used for a segmentation task, where all layers excep the average pooling and fully connected layer are used from the original ResNet architecture. $\endgroup$
    – Oxbowerce
    Commented Nov 24, 2021 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.