u2net生成肖像画:
https://mp.weixin.qq.com/s/XeVEqg2cpXgNHPvGu7oxVg
u2net_portrait.pth,已经下载了
import time
import torch
import torch.nn as nn
from torchvision import models
import torch.nn.functional as F
# best_model 642 u2netp_samll\u2netp_samll_11_train_0.188_tar_0.016.pth
# best_model 1330 1145 u2netp_samll\u2netp_samll_11_train_0.188_tar_0.016.pth
class REBNCONV_head(nn.Module):
def __init__(self,in_ch=3,out_ch=3,dirate=1):
super(REBNCONV_head,self).__init__()
self.conv_s1 = nn.Conv2d(in_ch,out_ch,5,padding=2,dilation=1*dirate)
self.bn_s1 = nn.BatchNorm2d(out_ch)