针对 Pascal VOC 和 Cityscapes 的预训练的 DeepLabv3 和 DeepLabv3+
针对 Pascal VOC 和 Cityscapes 的预训练的 DeepLabv3 和 DeepLabv3+
预训练的DeepLabv3、DeepLabv3+,用于Pascal VOC和Cityscapes数据集。
| DeepLabV3 | DeepLabV3+ |
|---|---|
| deeplabv3_resnet50 | deeplabv3plus_resnet50 |
| deeplabv3_resnet101 | deeplabv3plus_resnet101 |
| deeplabv3_mobilenet | deeplabv3plus_mobilenet |
| deeplabv3_hrnetv2_48 | deeplabv3plus_hrnetv2_48 |
| deeplabv3_hrnetv2_32 | deeplabv3plus_hrnetv2_32 |
| deeplabv3_xception | deeplabv3plus_xception |
| 请参阅 network/modeling.py 以获取所有模型条目。 | |
| 下载预训练模型:Dropbox、Tencent 微云 |
注意:HRNet 骨干网络由 @timothylimyl 贡献。预训练骨干网络可在 Google Drive 获取。
model = network.modeling.__dict__[MODEL_NAME](num_classes=NUM_CLASSES, output_stride=OUTPUT_SRTIDE)
model.load_state_dict( torch.load( PATH_TO_PTH )['model_state'] )outputs = model(images)
preds = outputs.max(1)[1].detach().cpu().numpy()
colorized_preds = val_dst.decode_target(preds).astype('uint8') # To RGB images, (N, H, W, 3), ranged 0~255, numpy array
# Do whatever you like here with the colorized segmentation maps
colorized_preds = Image.fromarray(colorized_preds[0]) # to PIL Image注意:本仓库中的所有预训练模型均未使用空洞可分离卷积进行训练。
本仓库支持空洞可分离卷积。我们提供了一个简单工具 network.convert_to_separable_conv,用于将 nn.Conv2d 转换为 AtrousSeparableConvolution。如需使用,请在运行 main.py 时加上 '--separable_conv' 参数。更多详情请参阅 'main.py' 和 'network/_deeplab.py'。
单张图像:
Python predict.py --input datasets/data/cityscapes/leftImg8bit/train/bremen/bremen_000000_000019_leftImg8bit.png --dataset cityscap暂无开放 Issues,或尚未同步最近议题。