医学图像分割—UNet(Pytorch)
github链接(欢迎多多star)修改文件路径就可以直接训练网络
有医学图像分割,图像分割研究兴趣的同学,欢迎交流!
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
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)
class