1 Star 1 Fork 0

hzx / u_net_liver

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
jiangpeng59 提交于 2020-06-19 11:36 . Update README.md

unet liver

Unet network for liver CT image segmentation

data preparation

structure of project

  --project
  	main.py
  	 --data
   		--train
   		--val

data and trained weight link: https://pan.baidu.com/s/1dgGnsfoSmL1lbOUwyItp6w code: 17yr

all dataset you can access from: https://competitions.codalab.org/competitions/15595

training

python main.py train

testing

load the last saved weight

python main.py test --ckpt=weights_19.pth

数据准备

项目文件分布如下

  --project
  	main.py
  	 --data
   		--train
   		--val

数据和权重可以使用百度云下载 链接:

链接: https://pan.baidu.com/s/1dgGnsfoSmL1lbOUwyItp6w 提取码: 17yr

全部数据集: https://competitions.codalab.org/competitions/15595

模型训练

python main.py train

测试模型训练

加载权重,默认保存最后一个权重

python main.py test --ckpt=weights_19.pth

多类别

修改2个地方即可:unet最后一层的通道数设置为类别数;损失函数使用CrossEntropyLoss

bath_size,img_size,num_classes=2,3,4
#model = Unet(3, num_classes)
criterion = nn.CrossEntropyLoss()
#assume the pred is the output of the model
pred=torch.rand(bath_size,num_classes,img_size,img_size)
target=torch.randint(num_classes,(bath_size,img_size,img_size))
loss=criterion(pred,target)

Demo

liver

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huangdachui888/u_net_liver.git
git@gitee.com:huangdachui888/u_net_liver.git
huangdachui888
u_net_liver
u_net_liver
master

搜索帮助