## Overview
This code provides various models combining dilated convolutions with residual networks. Our models can achieve better performance with less parameters than ResNet on [image classification](#image-classification) and [semantic segmentation](#semantic-image-segmentataion).
If you find this code useful for your publications, please consider citing
```
@inproceedings{Yu2017,
title = {Dilated Residual Networks},
author = {Fisher Yu and Vladlen Koltun and Thomas Funkhouser},
booktitle = {Computer Vision and Pattern Recognition (CVPR)},
year = {2017},
}
@inproceedings{Yu2016,
title = {Multi-scale context aggregation by dilated convolutions},
author = {Yu, Fisher and Koltun, Vladlen},
booktitle = {International Conference on Learning Representations (ICLR)},
year = {2016}
}
```
## Image Classification
Image classification is meant to be a controlled study to understand the role of high resolution feature maps in image classification and the class activations rising from it. Based on the investigation, we are able to design more efficient networks for learning high-resolution image representation. They have practical usage in semantic image segmentation, as detailed in [image segmentation section](#semantic-image-segmentataion).
### Models
Comparison of classification error rate on ImageNet validation set and numbers of parameters. It is evaluated on single center 224x224 crop from resized images whose shorter side is 256-pixel long.
| Name | Top-1 | Top-5 | Params |
| --- | :---: | :---: | :---: |
| ResNet-18 | 30.4% | 10.8% | 11.7M |
| DRN-A-18 | 28.0% | 9.5% | 11.7M |
| DRN-D-22 | 25.8% | 8.2% |16.4M |
| DRN-C-26 | 24.9% | 7.6% |21.1M |
| ResNet-34 | 27.7% | 8.7% | 21.8M |
| DRN-A-34 | 24.8% | 7.5% | 21.8M|
| DRN-D-38 | 23.8% | 6.9% |26.5M |
| DRN-C-42 | 22.9% | 6.6% |31.2M |
| ResNet-50 | 24.0% | 7.0% | 25.6M |
| DRN-A-50 | 22.9% | 6.6% | 25.6M |
| DRN-D-54 | 21.2% | 5.9% | 35.8M |
| DRN-C-58 | 21.7% | 6.0% | 41.6M |
| ResNet-101 | 22.4% | 6.2% | 44.5M |
| DRN-D-105 | 20.6% | 5.5% | 54.8M |
| ResNet-152 | 22.2% | 6.2% | 60.2M |
The figure below groups the parameter and error rate comparison based on netwok structures.
![comparison](doc/drn_comp.png)
### Training and Testing
The code is written in Python using [Pytorch](https://github.com/pytorch/pytorch). I started with code in [torchvision](https://github.com/pytorch/vision). Please check their license as well if copyright is your concern. Software dependency:
* Python 3
* Pillow
* pytorch
* torchvision
**Note** If you want to train your own semantic segmentation model, make sure your Pytorch version is greater than [0.2.0](https://github.com/pytorch/pytorch/releases) or includes commit [78020a](https://github.com/pytorch/pytorch/pull/2077/commits/78020a52abb76fcb1c344b3c42fbe8610cc387e4).
Go to [this page](https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md#download-the-imagenet-dataset) to prepare ImageNet 1K data.
To test a model on ImageNet validation set:
```
python3 classify.py test --arch drn_c_26 -j 4 <imagenet dir> --pretrained
```
To train a new model:
```
python3 classify.py train --arch drn_c_26 -j 8 <imagenet dir> --epochs 120
```
Besides `drn_c_26`, we also provide `drn_c_42` and `drn_c_58`. They are in DRN-C family as described in [Dilated Residual Networks](https://umich.app.box.com/v/drn). DRN-D models are simplified versions of DRN-C. Their code names are `drn_d_22`, `drn_d_38`, `drn_d_54`, and `drn_d_105`.
## Semantic Image Segmentataion
### Models
Comparison of mIoU on Cityscapes and numbers of parameters.
| Name | mIoU | Params |
| --- | :---: | :---: |
| DRN-A-50 | 67.3% | 25.6M |
| DRN-C-26 | 68.0% | 21.1M |
| DRN-C-42 | 70.9% | 31.2M |
| DRN-D-22 | 68.0% | 16.4M |
| DRN-D-38 | 71.4% | 26.5M |
### Prepare Data
The segmentation image data folder is supposed to contain following image lists with names below:
* train_images.txt
* train_labels.txt
* val_images.txt
* val_labels.txt
* test_images.txt
The code will also look for `info.json` in the folder. It contains mean and std of the training images. For example, below is `info.json` used for training on Cityscapes.
```
{
"mean": [
0.290101,
0.328081,
0.286964
],
"std": [
0.182954,
0.186566,
0.184475
]
}
```
Each line in the list is a path to an input image or its label map relative to the segmentation folder.
For example, if the data folder is "/foo/bar" and train_images.txt in it contains
```
leftImg8bit/train/aachen/aachen_000000_000019_leftImg8bit.png
leftImg8bit/train/aachen/aachen_000001_000019_leftImg8bit.png
```
and train_labels.txt contrains
```
gtFine/train/aachen/aachen_000000_000019_gtFine_trainIds.png
gtFine/train/aachen/aachen_000001_000019_gtFine_trainIds.png
```
Then the first image path is expected at
```
/foo/bar/leftImg8bit/train/aachen/aachen_000000_000019_leftImg8bit.png
```
and its label map is at
```
/foo/bar/gtFine/train/aachen/aachen_000000_000019_gtFine_trainIds.png
```
In training phase, both train_\* and val_\* are assumed to be in the data folder. In validation phase, only val_images.txt and val_labels.txt are needed. In testing phase, when there are no available labels, only test_images.txt is needed. `segment.py` has a command line option `--phase` and the corresponding acceptable arguments are `train`, `val`, and `test`.
### Optimization Setup
The current segmentation models are trained on basic data augmentation (random crops + flips). The learning rate is changed by steps, where it is decreased by a factor of 10 at each step.
### Training
To train a new model, use
```
python3 segment.py train -d <data_folder> -c <category_number> -s 896 \
--arch drn_d_22 --batch-size 8 --epochs 250 --lr 0.001 --momentum 0.99 \
--step 100
```
`category_number` is the number of categories in segmentation. It is 19 for Cityscapes and 11 for Camvid. The actual label maps should contain values in the range of `[0, category_number)`. Invalid pixels can be labeled as 255 and they will be ignored in training and evaluation.
### Testing
Evaluate models on testing set or any images without ground truth labels using our related pretrained model:
```
python3 segment.py test -d <data_folder> -c <category_number> --arch drn_d_22 \
--pretrained <model_path> --phase test --batch-size 1
```
You can download the pretrained DRN models on Cityscapes here: http://go.yf.io/drn-cityscapes-models.
If you want to evaluate a checkpoint from your own training, use `--resume` instead of `--pretrained`:
```
python3 segment.py test -d <data_folder> -c <category_number> --arch drn_d_22 \
--resume <model_path> --phase test --batch-size 1
```
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
drn.zip_PCBB_图像分割_语义分割 (108个子文件)
05123d01581fd96cead9abd0a5d498be8063a0 154B
05297fd13022aef3d70b9bdc70a1b1937813b9 56B
07b49970efa034e0eed9c53bb76816f5438965 251B
09a0e706ea30123295fa6593719c84e96403b6 251B
0dcb5bb22414af783066020755d93112b6b867 222B
101d388d7b97de0e2c8ae22e2f7558c5522422 219B
11b432083ce6823f5fed716ce6d1bc255552a5 6KB
15159af17a7b43f1658d085189ff04da3f2a41 163B
1a3df2a41798035f921a728de69c92d1566f1a 6KB
1ae761b380501eb7a438ef703bf9f67f0c4a57 169B
1c4159840549150784a2c9aa1d109a3335965a 159B
1e41efd46053b1deaed4cb12465fa8c14eff51 216B
21c31b633defadb78f8bd3070ead549733d00b 3KB
2271d48611e02a5d85aafe4d805076f76eae63 2KB
2629cfbf283017bf15ff892d80c1e2fcc034d6 249B
29a946b9af69e340789e9001baf0a1d2740b49 177B
2d9c6532c815efdbbd70126dc29d6e6e43a2ef 3KB
2e2e1ce1b5b74ef4de742be42a5826eb050cb5 165B
35816071c65e00326abc864fc33df0f642c56a 92KB
3a4c2b2bad7ae795ff50eb1f8212052ebbe750 251B
3b4b70765ad8251c86dc7f5e3d1fc7352d4cec 186B
3d0a3a935c8ecd6e9db1ea5aca9ba4b90851e5 149B
3edf7dde5a794e7d1b2a59f909b90fad3988ac 217B
48aed705bc4e5d1e3d70f2e1cd4d302ec4d5c5 153B
4ab48f99080d20605868af1142ef56e329c4d8 155B
4bed9a8db81c60f234ee60b27226b53da469e2 3KB
51b6c79d53057b2a56e420b8673160aacdad0c 2KB
5214b831828474d0544f4208f0bedd7bf5a92d 3KB
533d0fc6deffc014ecfde3e29f99ba0980bdaf 251B
55f12678e7e39ff8fd0473f683b1ce9203f95a 1KB
5adf8e45deddf12d438b8a7d1fdce9623f5f06 52B
61ace354e5c2938ec61b6699c5d499b7c938e3 3KB
635b8cdfe7d3573657d1cfe1ba43bf668cb8d2 249B
64929120249f1759cc571fb626fe3c86989cac 249B
731c79b09cde121381b35547238d6ee6756b50 251B
7c94b048954649d74ccb01c43125f5895ee0a5 1KB
7fedf24acd02114d61704adc49c1cd2a447322 3KB
88a94f29fe830c81e827369fc3808abaeccb19 154B
8e14f0963b19ccfcc08ef5e7c5b0736d05e202 6KB
9273cfab58acb14fccddf96c99be068f00efa7 3KB
927da76579d26679c52eacc0d9ad5c56f8a76b 2KB
92d33e586f543e33fbd677247de8da75acbc22 826B
989d630462f746f9f22a365a85744e3bf537d9 158B
aaf9c12442722de863d351b71a7eca263fd402 6KB
b818dfbee886bb625034eb550f71f505b1dc58 250B
b9c63098ac65c6b12480ba4dd263eeb28b02ab 57B
c0d490060fa32034c3029c1c748fa5535b44fc 96KB
c2b52f0ff890501e028c0d32d1aa779fd7f663 2KB
c89326db53ed25f52093dc11b1f97f3cf3898f 217B
cad186b3fe572157b5ec21feeb57d651288e9c 1KB
cdb1e8a9c13c9ea3da929347eb4c55796fa8cb 165B
config 255B
d2b7869e29368adee70cbbcadc949ca2879e70 157B
d3023c9f6e3a919934093e403d3fbbbd1c5c41 251B
d32618e89a8a0a9ef6d11d52eeabf902a20795 1KB
d4062b5aa700cbf4114af18bb2dd94f94a632c 157B
d80d5d5a6212329df2835fba999b0b01cc2164 158B
dbc8f0f72b4ebf9a5601852ffcced4def8429a 141B
dc44ca6c7477414603c30a04aeb72b63338ebd 3KB
description 73B
e0adc9ce8344278d583d1d6e92a24ab16fea59 157B
e9f59cb76ea5c4a6a9e553f5bbd27ce35823a6 221B
ea58016674cca3b336c87321e94c8b6d72766a 152B
ed1dab3616761dc954fa67750260538a8e4d6e 2KB
ed822cb4c769226c4ac8c745cf0af5f0020116 2KB
ef091d4c20f5240de3fcadd4401897afb0a9f7 251B
exclude 240B
f1710bb683cdf53e57fcc0470add288bcadc55 1KB
f528323b1b17e20f270f3fbe18eb079e960603 159B
f80b90463e41e18fcfe057b01d9122cfb17057 159B
f837559bb10f172c011b7d33e919fb894c7f5d 6KB
f8d23887f54647e10d640478e297be439ffbad 3KB
f994c435bb6b32684dde515b561c28ae67796d 217B
fa472ec87611efe4bfc6da5958a2afd505b918 250B
fa80f5c4467a06bd6131576469f4c770ec2e54 450B
fac92263d66e98f259ba3d8a88877eca0a74e8 217B
fac9cc027c1eca5654942cb8a90e205a80b1f5 2KB
fbfe1d248139a36c967c2a43cf69b033b44f7e 6KB
fcde992c38a9c6375cb6e457c708aa172e5dbd 217B
fd0b9a1752cb539eb3183f1af918ca64962300 217B
fd21c0c6ee20246062574c088c440b7f8cb43f 159B
fd326743419de72260255625787cfa1795bca2 217B
ff417a31bb1f9e9bc0f6a7a4a96b72456eb835 721B
HEAD 172B
HEAD 172B
HEAD 32B
HEAD 23B
index 637B
LICENSE 1KB
master 172B
master 41B
README.md 7KB
packed-refs 172B
drn_comp.png 105KB
segment.py 19KB
classify.py 12KB
drn.py 10KB
data_transforms.py 4KB
drn.pyc 9KB
pre-rebase.sample 5KB
共 108 条
- 1
- 2
资源评论
局外狗
- 粉丝: 66
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功