1 介紹
U-Net是一篇基本結構非常好的論文,主要是針對生物醫學圖片的分割,而且,在今後的許多對醫學圖像的分割網絡中,很大一部分會採取U-Net作爲網絡的主幹。相對於當年的,在EM segmentation challenge at ISBI 2012上做到比當時的best更好。而且速度也非常的快。其有一個很好的優點,就是在小數據集上也是能做得比較好的。就比如EM 2012這個數據集就只是30個果蠅第一齡幼蟲腹側神經所索的連續部分透射電子顯微鏡圖。
本文主要利用pytorch實現了U-Net網絡的腦腫瘤分割,並展示了部分分割效果圖。希望對你有所幫助!
2 源代碼
(1)網絡結構代碼
import torch.nn as nn
import torch
from torch import autograd
class DoubleConv(nn.Module):
def __init__(self, in_ch, out_ch):
super(DoubleConv, self).__init__()
self.conv = nn.Sequential(
nn.Conv2d(in_ch, out_ch, 3, padding=1),
nn.BatchNorm2d(out_ch),
nn.ReLU(inplace=True),
nn.Conv2d(out_ch, out_ch, 3, padding=1),
nn.BatchNorm2d(out_ch),
nn.ReLU(inplace=True)
)
def forward(self, input):
return self.conv(input