## Transfer Learning for Semantic Segmentation using PyTorch DeepLab v3
This repository contains code for Fine Tuning [DeepLabV3 ResNet101](https://arxiv.org/abs/1706.05587) in PyTorch. The model is from the [torchvision module](https://pytorch.org/docs/stable/torchvision/models.html#semantic-segmentation). The tutorial can be found here: [https://towardsdatascience.com/transfer-learning-for-segmentation-using-deeplabv3-in-pytorch-f770863d6a42?sk=b403331a7b30c02bff165a93823a5524](https://towardsdatascience.com/transfer-learning-for-segmentation-using-deeplabv3-in-pytorch-f770863d6a42?sk=b403331a7b30c02bff165a93823a5524)
I've fine tuned the model for the [CrackForest](https://github.com/cuilimeng/CrackForest-dataset) data-set.
The model was fine tuned for 25 epochs and achieves an testing AUROC value of 0.842.
The segmentation output of the model on a sample image are shown below.
![Sample segmentation output](./CFExp/SegmentationOutput.png)
### Installing dependencies
#### Using pip
```
pip install -r requirements.txt
```
#### Using conda
```
conda env create -f environment.yml
```
### Usage of the module
```
Usage: main.py [OPTIONS]
Options:
--data-directory TEXT Specify the data directory. [required]
--exp_directory TEXT Specify the experiment directory. [required]
--epochs INTEGER Specify the number of epochs you want to run the
experiment for. Default is 25.
--batch-size INTEGER Specify the batch size for the dataloader. Default is 4.
--help Show this message and exit.
```
To run the code with the CrackForest dataset and store the results in folder called CFExp use the following command.
```
python main.py --data-directory CrackForest --exp_directory CFExp
```
The datahandler module has two functions for creating datasets fron single and different folders.
1. ```
def get_dataloader_sep_folder(data_dir: str,
image_folder: str = 'Image',
mask_folder: str = 'Mask',
batch_size: int = 4)
```
Create Train and Test dataloaders from two separate Train and Test folders. The directory structure should be as follows.
```
data_dir
--Train
------Image
---------Image1
---------ImageN
------Mask
---------Mask1
---------MaskN
--Test
------Image
---------Image1
---------ImageM
------Mask
---------Mask1
---------MaskM
```
2. ```
def get_dataloader_single_folder(data_dir: str,
image_folder: str = 'Images',
mask_folder: str = 'Masks',
fraction: float = 0.2,
batch_size: int = 4)
```
Create from a single folder. The structure should be as follows.
```
--data_dir
------Image
---------Image1
---------ImageN
------Mask
---------Mask1
---------MaskN
```
The repository also contains a JupyterLab file with the loss and metric plots as well as the sample prediction code.
## Citation
If you found this repository to be useful and use it in your work, please consider citing it:
Bibtex Entry:
@misc{minhas_2019, title={Transfer Learning for Semantic Segmentation using PyTorch DeepLab v3}, url={https://github.com/msminhas93/DeepLabv3FineTuning}, journal={GitHub.com/msminhas93}, author={Minhas, Manpreet Singh}, year={2019}, month={Sep}}
IEEE Format Citation:
M. S. Minhas, “Transfer Learning for Semantic Segmentation using PyTorch DeepLab v3,” GitHub.com/msminhas93, 12-Sep-2019. [Online]. Available: https://github.com/msminhas93/DeepLabv3FineTuning.
没有合适的资源?快使用搜索试试~ 我知道了~
deeplabv3语义分割迁移代码
共777个文件
png:398个
jpg:346个
py:17个
需积分: 1 0 下载量 162 浏览量
2024-03-19
11:52:52
上传
评论
收藏 346.61MB ZIP 举报
温馨提示
deeplabv3语义分割迁移代码
资源推荐
资源详情
资源评论
收起资源包目录
deeplabv3语义分割迁移代码 (777个子文件)
log.csv 673B
.gitignore 757B
SegmentationDatasetDemo.ipynb 223KB
SegmentationDatasetDemo-checkpoint.ipynb 223KB
DatasetExploration-checkpoint.ipynb 223KB
Analysis-checkpoint.ipynb 147KB
Analysis.ipynb 37KB
2.jpg 2.05MB
s0002.jpg 2.05MB
s2.jpg 2.05MB
0002.jpg 2.05MB
s002.jpg 2.05MB
002.jpg 2.05MB
s00a.jpg 1.7MB
a.jpg 1.7MB
000a.jpg 1.7MB
sa.jpg 1.7MB
s000a.jpg 1.7MB
00a.jpg 1.7MB
003.jpg 1.67MB
0003.jpg 1.67MB
3.jpg 1.67MB
s3.jpg 1.67MB
s003.jpg 1.67MB
s0003.jpg 1.67MB
s001.jpg 1.58MB
s1.jpg 1.58MB
1.jpg 1.58MB
s0001.jpg 1.58MB
0001.jpg 1.58MB
001.jpg 1.58MB
s00f.jpg 1.57MB
s000f.jpg 1.57MB
f.jpg 1.57MB
00f.jpg 1.57MB
000f.jpg 1.57MB
sf.jpg 1.57MB
s0004.jpg 1.53MB
0004.jpg 1.53MB
s004.jpg 1.53MB
s4.jpg 1.53MB
004.jpg 1.53MB
4.jpg 1.53MB
s000d.jpg 1.53MB
sd.jpg 1.53MB
00d.jpg 1.53MB
000d.jpg 1.53MB
d.jpg 1.53MB
s00d.jpg 1.53MB
c.jpg 1.52MB
s00c.jpg 1.52MB
s000c.jpg 1.52MB
00c.jpg 1.52MB
000c.jpg 1.52MB
sc.jpg 1.52MB
s00g.jpg 1.49MB
00g.jpg 1.49MB
s000g.jpg 1.49MB
g.jpg 1.49MB
000g.jpg 1.49MB
sg.jpg 1.49MB
b.jpg 1.47MB
000b.jpg 1.47MB
00b.jpg 1.47MB
sb.jpg 1.47MB
s00b.jpg 1.47MB
s000b.jpg 1.47MB
sh.jpg 1.45MB
s000h.jpg 1.45MB
h.jpg 1.45MB
000h.jpg 1.45MB
s00h.jpg 1.45MB
00h.jpg 1.45MB
i.jpg 1.44MB
s00i.jpg 1.44MB
000i.jpg 1.44MB
si.jpg 1.44MB
00i.jpg 1.44MB
s000i.jpg 1.44MB
j.jpg 283KB
5.jpg 261KB
2.jpg 253KB
m.jpg 238KB
l.jpg 232KB
a.jpg 207KB
b.jpg 205KB
3.jpg 204KB
g.jpg 202KB
k.jpg 200KB
4.jpg 196KB
1.jpg 194KB
f.jpg 193KB
d.jpg 188KB
c.jpg 187KB
h.jpg 176KB
i.jpg 169KB
j.jpg 73KB
j.jpg 73KB
j.jpg 73KB
j.jpg 73KB
共 777 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
weixin_44722015
- 粉丝: 41
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功