## 3DUNet implemented with pytorch
## Introduction
The repository is a 3DUNet implemented with pytorch, referring to
this [project](https://github.com/panxiaobai/lits_pytorch).
I have redesigned the code structure and used the model to perform liver and tumor segmentation on the lits2017 dataset.
paper: [3D U-Net: Learning Dense Volumetric Segmentation from Sparse Annotation](https://lmb.informatik.uni-freiburg.de/Publications/2016/CABR16/cicek16miccai.pdf)
### Requirements:
```angular2
pytorch >= 1.1.0
torchvision
SimpleITK
Tensorboard
Scipy
```
### Code Structure
```angular2
├── dataset # Training and testing dataset
│ ├── dataset_lits_train.py
│ ├── dataset_lits_val.py
│ ├── dataset_lits_test.py
│ └── transforms.py
├── models # Model design
│ ├── nn
│ │ └── module.py
│ │── ResUNet.py # 3DUNet class
│ │── Unet.py # 3DUNet class
│ │── SegNet.py # 3DUNet class
│ └── KiUNet.py # 3DUNet class
├── experiments # Trained model
|── utils # Some related tools
| ├── common.py
| ├── weights_init.py
| ├── logger.py
| ├── metrics.py
| └── loss.py
├── preprocess_LiTS.py # preprocessing for raw data
├── test.py # Test code
├── train.py # Standard training code
└── config.py # Configuration information for training and testing
```
## Quickly Start
### 1) LITS2017 dataset preprocessing:
1. Download dataset from google drive: [Liver Tumor Segmentation Challenge.](https://drive.google.com/drive/folders/0B0vscETPGI1-Q1h1WFdEM2FHSUE)
Or from my share: https://pan.baidu.com/s/1WgP2Ttxn_CV-yRT4UyqHWw
Extraction code:**hfl8** (The dataset consists of two parts: batch1 and batch2)
2. Then you need decompress and merge batch1 and batch2 into one folder. It is recommended to use 20 samples(27\~46) of the LiTS dataset as the testset
and 111 samples(0\~26 and 47\~131) as the trainset. Please put the volume data and segmentation labels of trainset and testset into different local folders,
such as:
```
raw_dataset:
├── test # 20 samples(27~46)
│ ├── ct
│ │ ├── volume-27.nii
│ │ ├── volume-28.nii
| | |—— ...
│ └── label
│ ├── segmentation-27.nii
│ ├── segmentation-28.nii
| |—— ...
│
├── train # 111 samples(0\~26 and 47\~131)
│ ├── ct
│ │ ├── volume-0.nii
│ │ ├── volume-1.nii
| | |—— ...
│ └── label
│ ├── segmentation-0.nii
│ ├── segmentation-1.nii
| |—— ...
```
3. Finally, you need to change the root path of the volume data and segmentation labels in `./preprocess_LiTS.py`, such as:
```
row_dataset_path = './raw_dataset/train/' # path of origin dataset
fixed_dataset_path = './fixed_data/' # path of fixed(preprocessed) dataset
```
4. Run `python ./preprocess_LiTS.py`
If nothing goes wrong, you can see the following files in the dir `./fixed_data`
```angular2
│—— train_path_list.txt
│—— val_path_list.txt
│
|—— ct
│ volume-0.nii
│ volume-1.nii
│ volume-2.nii
│ ...
└─ label
segmentation-0.nii
segmentation-1.nii
segmentation-2.nii
...
```
---
### 2) Training 3DUNet
1. Firstly, you should change the some parameters in `config.py`,especially, please set `--dataset_path` to `./fixed_data`
All parameters are commented in the file `config.py`.
2. Secondely,run `python train.py --save model_name`
3. Besides, you can observe the dice and loss during the training process
in the browser through `tensorboard --logdir ./output/model_name`.
---
### 3) Testing 3DUNet
run `test.py`
Please pay attention to path of trained model in `test.py`.
(Since the calculation of the 3D convolution operation is too large,
I use a sliding window to block the input tensor before prediction, and then stitch the results to get the final result.
The size of the sliding window can be set by yourself in `config.py`)
After the test, you can get the test results in the corresponding folder:`./experiments/model_name/result`
You can also read my Chinese introduction about this 3DUNet project [here](https://zhuanlan.zhihu.com/p/113318562). However, I no longer update the blog, I will try my best to update the github code.
If you have any suggestions or questions,
welcome to open an issue to communicate with me.
没有合适的资源?快使用搜索试试~ 我知道了~
深度学习项目--基于深度卷积网络的肝脏分割.zip
共43个文件
py:18个
pyc:15个
xml:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 35 浏览量
2024-05-08
21:26:40
上传
评论
收藏 50KB ZIP 举报
温馨提示
深度学习项目--基于深度卷积网络的肝脏分割.zip
资源推荐
资源详情
资源评论
收起资源包目录
深度学习项目--基于深度卷积网络的肝脏分割.zip (43个子文件)
content
experiments
README.md 269B
utils
loss.py 4KB
metrics.py 2KB
weights_init.py 2KB
common.py 2KB
logger.py 2KB
__pycache__
weights_init.cpython-37.pyc 2KB
metrics.cpython-37.pyc 2KB
common.cpython-37.pyc 2KB
logger.cpython-37.pyc 3KB
loss.cpython-37.pyc 5KB
dataset
dataset_lits_test.py 5KB
dataset_lits_val.py 2KB
transforms.py 5KB
dataset_lits_train.py 2KB
__pycache__
dataset_lits_val.cpython-36.pyc 2KB
dataset_lits_train.cpython-37.pyc 2KB
transforms.cpython-37.pyc 7KB
dataset_lits_val.cpython-37.pyc 2KB
.idea
untitled.iml 352B
misc.xml 295B
dataSources.xml 878B
inspectionProfiles
profiles_settings.xml 174B
modules.xml 268B
.gitignore 176B
Untitled.ipynb 14KB
models
__init__.py 120B
nn
module.py 2KB
ResUNet.py 6KB
KiUNet.py 12KB
SegNet.py 3KB
UNet.py 3KB
__pycache__
SegNet.cpython-37.pyc 2KB
ResUNet.cpython-37.pyc 3KB
__init__.cpython-37.pyc 293B
KiUNet.cpython-37.pyc 7KB
UNet.cpython-37.pyc 2KB
README.md 675B
train.py 4KB
__pycache__
config.cpython-37.pyc 2KB
test.py 2KB
README.md 5KB
config.py 2KB
共 43 条
- 1
资源评论
生瓜蛋子
- 粉丝: 3824
- 资源: 5626
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功