Pretrained deeplabv3_resnet50_coco is not supported as of now

I am getting the previous error when I use the following line of code:

model=torchvision.models.segmentation.deeplabv3_resnet50(pretrained=True)

This model was added 8 days ago in this PR, so you could install the nightly binary or build from source to use it. :wink:

How can I finetuning this model?? @ptrblck This model return an ordered dict where key out has the output image but values are not 0 or 1 in binary segmentation!

The model wasn’t trained on a binary segmentation use case, but for 20 classes as stated in the docs:

The pre-trained models have been trained on a subset of COCO train2017, on the 20 categories that are present in the Pascal VOC dataset. You can see more information on how the subset has been selected in references/segmentation/coco_utils.py .

Most likely you will get an activation containing the logits for these 20 classes (in dim1).
If you are dealing with a binary segmentation use case, you could set num_classes=2 (for a binary multi-class segmentation using nn.CrossEntropyLoss) or num_classes=1 (for a binary segmentation using nn.BCEWithLogitsLoss) in the instantiation of the model.

Understood, I got this working this morning.

However, I tried to make it work with resnet34 as backbone and it throws me Dilatation>1 not supported.

There is a pull request that solves this:

Could the backbone weights work with my problem? So just deeplab head weights need to get retrained!

Is this right?

That should be possible, yes.

!pip install git+https://github.com/pytorch/vision.git@nightly

Is not working! How can i install just turchvision nightly?

Please refer to the install instructions.

It looks like pretrained deeplabv3_resnet50 have been added to torchvision 0.6. However, when I try to use them it says that they is not implemented

Could you post the installed torchvision version via print(torchvision.__version__)?

This is the version that gets printed: 0.6.0a0+82fd1c8

This is a pre-release version, so you would have to update to 0.6 or the nightly binary.

It was installed from pytorch channel on anaconda
after the solution. How can I install it properly?

I installed from pip now and says: 0.6.0.

However, I am getting same error: NotImplementedError: pretrained deeplabv3_resnet50_coco is not supported as of now

You are right. The model didn’t make it into 0.6.0 and missed the code freeze apparently by a day, so you would still need to install the latest nightly.