2
2
layout : hub_detail
3
3
background-class : hub-background
4
4
body-class : hub
5
- title : Deeplabv3-ResNet101
6
- summary : DeepLabV3 model with a ResNet-101 backbone
5
+ title : Deeplabv3
6
+ summary : DeepLabV3 models with ResNet-50, ResNet-101 and MobileNet-V3 backbones
7
7
category : researchers
8
8
image : deeplab2.png
9
9
author : Pytorch Team
@@ -18,7 +18,10 @@ order: 1
18
18
19
19
``` python
20
20
import torch
21
- model = torch.hub.load(' pytorch/vision:v0.10.0' , ' deeplabv3_resnet101' , pretrained = True )
21
+ model = torch.hub.load(' pytorch/vision:v0.10.0' , ' deeplabv3_resnet50' , pretrained = True )
22
+ # or any of these variants
23
+ # model = torch.hub.load('pytorch/vision:v0.10.0', 'deeplabv3_resnet101', pretrained=True)
24
+ # model = torch.hub.load('pytorch/vision:v0.10.0', 'deeplabv3_mobilenet_v3_large', pretrained=True)
22
25
model.eval()
23
26
```
24
27
@@ -35,7 +38,7 @@ So, `output['out']` is of shape `(N, 21, H, W)`. More documentation can be found
35
38
``` python
36
39
# Download an example image from the pytorch website
37
40
import urllib
38
- url, filename = (" https://github.com/pytorch/hub/raw/master/images/dog.jpg " , " dog.jpg " )
41
+ url, filename = (" https://github.com/pytorch/hub/raw/master/images/deeplab1.png " , " deeplab1.png " )
39
42
try : urllib.URLopener().retrieve(url, filename)
40
43
except : urllib.request.urlretrieve(url, filename)
41
44
```
@@ -45,6 +48,7 @@ except: urllib.request.urlretrieve(url, filename)
45
48
from PIL import Image
46
49
from torchvision import transforms
47
50
input_image = Image.open(filename)
51
+ input_image = input_image.convert(" RGB" )
48
52
preprocess = transforms.Compose([
49
53
transforms.ToTensor(),
50
54
transforms.Normalize(mean = [0.485 , 0.456 , 0.406 ], std = [0.229 , 0.224 , 0.225 ]),
@@ -86,14 +90,17 @@ plt.imshow(r)
86
90
87
91
### Model Description
88
92
89
- Deeplabv3-ResNet101 is constructed by a Deeplabv3 model with a ResNet-101 backbone.
93
+ Deeplabv3-ResNet is constructed by a Deeplabv3 model using a ResNet-50 or ResNet-101 backbone.
94
+ Deeplabv3-MobileNetV3-Large is constructed by a Deeplabv3 model using the MobileNetV3 large backbone.
90
95
The pre-trained model has been trained on a subset of COCO train2017, on the 20 categories that are present in the Pascal VOC dataset.
91
96
92
97
Their accuracies of the pre-trained models evaluated on COCO val2017 dataset are listed below.
93
98
94
- | Model structure | Mean IOU | Global Pixelwise Accuracy |
95
- | ------------------- | ----------- | --------------------------|
96
- | deeplabv3_resnet101 | 67.4 | 92.4 |
99
+ | Model structure | Mean IOU | Global Pixelwise Accuracy |
100
+ | ---------------------------- | ----------- | --------------------------|
101
+ | deeplabv3_resnet50 | 66.4 | 92.4 |
102
+ | deeplabv3_resnet101 | 67.4 | 92.4 |
103
+ | deeplabv3_mobilenet_v3_large | 60.3 | 91.2 |
97
104
98
105
### Resources
99
106
0 commit comments