# DeepLabV3Plus-Pytorch **Repository Path**: cheng4632/DeepLabV3Plus-Pytorch ## Basic Information - **Project Name**: DeepLabV3Plus-Pytorch - **Description**: 同步 https://github.com/VainF/DeepLabV3Plus-Pytorch - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-09-06 - **Last Updated**: 2022-09-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DeepLabv3Plus-Pytorch DeepLabv3, DeepLabv3+ with pretrained models for Pascal VOC & Cityscapes. ## Quick Start ### 1. Available Architectures Specify the model architecture with '--model ARCH_NAME' and set the output stride using '--output_stride OUTPUT_STRIDE'. | DeepLabV3 | DeepLabV3+ | | :---: | :---: | |deeplabv3_resnet50|deeplabv3plus_resnet50| |deeplabv3_resnet101|deeplabv3plus_resnet101| |deeplabv3_mobilenet|deeplabv3plus_mobilenet | All pretrained models: [Dropbox](https://www.dropbox.com/sh/w3z9z8lqpi8b2w7/AAB0vkl4F5vy6HdIhmRCTKHSa?dl=0), [Tencent Weiyun](https://share.weiyun.com/qqx78Pv5) ### 2. Load the pretrained model: ```python model.load_state_dict( torch.load( CKPT_PATH )['model_state'] ) ``` ### 3. Visualize segmentation outputs: ```python 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 ``` ### 4. Atrous Separable Convolution **Note**: pre-trained models in this repo **do not** use Seperable Conv. Atrous Separable Convolution is supported in this repo. We provide a simple tool ``network.convert_to_separable_conv`` to convert ``nn.Conv2d`` to ``AtrousSeparableConvolution``. **Please run main.py with '--separable_conv' if it is required**. See 'main.py' and 'network/_deeplab.py' for more details. ### 5. Prediction Single image: ```bash python predict.py --input ~/Datasets/Cityscapes/leftImg8bit/train/bremen/bremen_000000_000019_leftImg8bit.png --dataset cityscapes --model deeplabv3plus_mobilenet --ckpt checkpoints/best_deeplabv3plus_mobilenet_cityscapes_os16.pth --save_val_results_to test_results ``` Image folder: ```bash python predict.py --input ~/Datasets/Cityscapes/leftImg8bit/train/bremen --dataset cityscapes --model deeplabv3plus_mobilenet --ckpt checkpoints/best_deeplabv3plus_mobilenet_cityscapes_os16.pth --save_val_results_to test_results ``` ## Results ### 1. Performance on Pascal VOC2012 Aug (21 classes, 513 x 513) Training: 513x513 random crop validation: 513x513 center crop | Model | Batch Size | FLOPs | train/val OS | mIoU | Dropbox | Tencent Weiyun | | :-------- | :-------------: | :----: | :-----------: | :--------: | :--------: | :----: | | DeepLabV3-MobileNet | 16 | 6.0G | 16/16 | 0.701 | [Download](https://www.dropbox.com/s/uhksxwfcim3nkpo/best_deeplabv3_mobilenet_voc_os16.pth?dl=0) | [Download](https://share.weiyun.com/A4ubD1DD) | | DeepLabV3-ResNet50 | 16 | 51.4G | 16/16 | 0.769 | [Download](https://www.dropbox.com/s/3eag5ojccwiexkq/best_deeplabv3_resnet50_voc_os16.pth?dl=0) | [Download](https://share.weiyun.com/33eLjnVL) | | DeepLabV3-ResNet101 | 16 | 72.1G | 16/16 | 0.773 | [Download](https://www.dropbox.com/s/vtenndnsrnh4068/best_deeplabv3_resnet101_voc_os16.pth?dl=0) | [Download](https://share.weiyun.com/iCkzATAw) | | DeepLabV3Plus-MobileNet | 16 | 17.0G | 16/16 | 0.711 | [Download](https://www.dropbox.com/s/0idrhwz6opaj7q4/best_deeplabv3plus_mobilenet_voc_os16.pth?dl=0) | [Download](https://share.weiyun.com/djX6MDwM) | | DeepLabV3Plus-ResNet50 | 16 | 62.7G | 16/16 | 0.772 | [Download](https://www.dropbox.com/s/dgxyd3jkyz24voa/best_deeplabv3plus_resnet50_voc_os16.pth?dl=0) | [Download](https://share.weiyun.com/uTM4i2jG) | | DeepLabV3Plus-ResNet101 | 16 | 83.4G | 16/16 | 0.783 | [Download](https://www.dropbox.com/s/bm3hxe7wmakaqc5/best_deeplabv3plus_resnet101_voc_os16.pth?dl=0) | [Download](https://share.weiyun.com/UNPZr3dk) | ### 2. Performance on Cityscapes (19 classes, 1024 x 2048) Training: 768x768 random crop validation: 1024x2048 | Model | Batch Size | FLOPs | train/val OS | mIoU | Dropbox | Tencent Weiyun | | :-------- | :-------------: | :----: | :-----------: | :--------: | :--------: | :----: | | DeepLabV3Plus-MobileNet | 16 | 135G | 16/16 | 0.721 | [Download](https://www.dropbox.com/s/753ojyvsh3vdjol/best_deeplabv3plus_mobilenet_cityscapes_os16.pth?dl=0) | [Download](https://share.weiyun.com/aSKjdpbL) | DeepLabV3Plus-ResNet101 | 16 | N/A | 16/16 | 0.762 | [Download](https://drive.google.com/file/d/1t7TC8mxQaFECt4jutdq_NMnWxdm6B-Nb/view?usp=sharing) | [Comming Soon]() #### Segmentation Results on Pascal VOC2012 (DeepLabv3Plus-MobileNet)