国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁(yè) > news >正文

在百度上做網(wǎng)站西安百度推廣優(yōu)化托管

在百度上做網(wǎng)站,西安百度推廣優(yōu)化托管,學(xué)做網(wǎng)站快嗎,一個(gè)網(wǎng)站怎么做軟件下載基于深度學(xué)習(xí)的圖像去雨去霧 文末附有源碼下載地址 b站視頻地址: https://www.bilibili.com/video/BV1Jr421p7cT/ 基于深度學(xué)習(xí)的圖像去雨去霧,使用的網(wǎng)絡(luò)為unet, 網(wǎng)絡(luò)代碼: import torch import torch.nn as nn from torchsumm…

基于深度學(xué)習(xí)的圖像去雨去霧


文末附有源碼下載地址
b站視頻地址: https://www.bilibili.com/video/BV1Jr421p7cT/

基于深度學(xué)習(xí)的圖像去雨去霧,使用的網(wǎng)絡(luò)為unet,
網(wǎng)絡(luò)代碼:

import torch
import torch.nn as nn
from torchsummary import summary
from torchvision import models
from torchvision.models.feature_extraction import create_feature_extractor
import torch.nn.functional as F
from torchstat import statclass Resnet18(nn.Module):def __init__(self):super(Resnet18, self).__init__()self.resnet = models.resnet18(pretrained=False)# self.resnet = create_feature_extractor(self.resnet, {'relu': 'feat320', 'layer1': 'feat160', 'layer2': 'feat80',#                                                'layer3': 'feat40'})def forward(self,x):for name,m in self.resnet._modules.items():x=m(x)if name=='relu':x1=xelif name=='layer1':x2=xelif name=='layer2':x3=xelif name=='layer3':x4=xbreak# x=self.resnet(x)return x1,x2,x3,x4
class Linears(nn.Module):def __init__(self,a,b):super(Linears, self).__init__()self.linear1=nn.Linear(a,b)self.relu1=nn.LeakyReLU()self.linear2 = nn.Linear(b, a)self.sigmoid=nn.Sigmoid()def forward(self,x):x=self.linear1(x)x=self.relu1(x)x=self.linear2(x)x=self.sigmoid(x)return x
class DenseNetBlock(nn.Module):def __init__(self,inplanes=1,planes=1,stride=1):super(DenseNetBlock,self).__init__()self.conv1=nn.Conv2d(inplanes,planes,3,stride,1)self.bn1 = nn.BatchNorm2d(planes)self.relu1=nn.LeakyReLU()self.conv2 = nn.Conv2d(inplanes, planes, 3,stride,1)self.bn2 = nn.BatchNorm2d(planes)self.relu2 = nn.LeakyReLU()self.conv3 = nn.Conv2d(inplanes, planes, 3,stride,1)self.bn3 = nn.BatchNorm2d(planes)self.relu3 = nn.LeakyReLU()def forward(self,x):ins=xx=self.conv1(x)x=self.bn1(x)x=self.relu1(x)x = self.conv2(x)x = self.bn2(x)x = self.relu2(x)x=x+insx2=self.conv3(x)x2 = self.bn3(x2)x2=self.relu3(x2)out=ins+x+x2return out
class SEnet(nn.Module):def __init__(self,chs,reduction=4):super(SEnet,self).__init__()self.average_pooling = nn.AdaptiveAvgPool2d(output_size=(1, 1))self.fc = nn.Sequential(# First reduce dimension, then raise dimension.# Add nonlinear processing to fit the correlation between channelsnn.Linear(chs, chs // reduction),nn.LeakyReLU(inplace=True),nn.Linear(chs // reduction, chs))self.activation = nn.Sigmoid()def forward(self,x):ins=xbatch_size, chs, h, w = x.shapex=self.average_pooling(x)x = x.view(batch_size, chs)x=self.fc(x)x = x.view(batch_size,chs,1,1)return x*ins
class UAFM(nn.Module):def __init__(self):super(UAFM, self).__init__()# self.meanPool_C=torch.max()self.attention=nn.Sequential(nn.Conv2d(4, 8, 3, 1,1),nn.LeakyReLU(),nn.Conv2d(8, 1, 1, 1),nn.Sigmoid())def forward(self,x1,x2):x1_mean_pool=torch.mean(x1,dim=1)x1_max_pool,_=torch.max(x1,dim=1)x2_mean_pool = torch.mean(x2, dim=1)x2_max_pool,_ = torch.max(x2, dim=1)x1_mean_pool=torch.unsqueeze(x1_mean_pool,dim=1)x1_max_pool=torch.unsqueeze(x1_max_pool,dim=1)x2_mean_pool=torch.unsqueeze(x2_mean_pool,dim=1)x2_max_pool=torch.unsqueeze(x2_max_pool,dim=1)cat=torch.cat((x1_mean_pool,x1_max_pool,x2_mean_pool,x2_max_pool),dim=1)a=self.attention(cat)out=x1*a+x2*(1-a)return outclass Net(nn.Module):def __init__(self):super(Net, self).__init__()self.resnet18=Resnet18()self.SENet=SEnet(chs=256)self.UAFM=UAFM()self.DenseNet1=DenseNetBlock(inplanes=256,planes=256)self.transConv1=nn.ConvTranspose2d(256,128,3,2,1,output_padding=1)self.DenseNet2 = DenseNetBlock(inplanes=128, planes=128)self.transConv2 = nn.ConvTranspose2d(128, 64, 3, 2, 1, output_padding=1)self.DenseNet3 = DenseNetBlock(inplanes=64, planes=64)self.transConv3 = nn.ConvTranspose2d(64, 64, 3, 2, 1, output_padding=1)self.transConv4 = nn.ConvTranspose2d(64, 32, 3, 2, 1, output_padding=1)self.DenseNet4=DenseNetBlock(inplanes=32,planes=32)self.out=nn.Sequential(nn.Conv2d(32,3,1,1),nn.Sigmoid())def forward(self,x):"""下采樣部分"""x1,x2,x3,x4=self.resnet18(x)# feat320=features['feat320']# feat160=features['feat160']# feat80=features['feat80']# feat40=features['feat40']feat320=x1feat160=x2feat80=x3feat40=x4"""上采樣部分"""x=self.SENet(feat40)x=self.DenseNet1(x)x=self.transConv1(x)x=self.UAFM(x,feat80)x=self.DenseNet2(x)x=self.transConv2(x)x=self.UAFM(x,feat160)x = self.DenseNet3(x)x = self.transConv3(x)x = self.UAFM(x, feat320)x=self.transConv4(x)x=self.DenseNet4(x)out=self.out(x)# out=torch.concat((out,out,out),dim=1)*255.return outdef freeze_backbone(self):for param in self.resnet18.parameters():param.requires_grad = Falsedef unfreeze_backbone(self):for param in self.resnet18.parameters():param.requires_grad = Trueif __name__ == '__main__':net=Net()print(net)# stat(net,(3,640,640))summary(net,input_size=(3,512,512),device='cpu')aa=torch.ones((6,3,512,512))out=net(aa)print(out.shape)# ii=torch.zeros((1,3,640,640))# outs=net(ii)# print(outs.shape)

主題界面顯示及代碼:
在這里插入圖片描述

from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from untitled import Ui_Form
import sys
import cv2 as cv
from PyQt5.QtCore import QCoreApplication
import numpy as np
from PyQt5 import QtCore,QtGui
from PIL import Image
from predict import *class My(QMainWindow,Ui_Form):def __init__(self):super(My,self).__init__()self.setupUi(self)self.setWindowTitle('圖像去雨去霧')self.setIcon()self.pushButton.clicked.connect(self.pic)self.pushButton_2.clicked.connect(self.pre)self.pushButton_3.clicked.connect(self.pre2)def setIcon(self):palette1 = QPalette()# palette1.setColor(self.backgroundRole(), QColor(192,253,123))   # 設(shè)置背景顏色palette1.setBrush(self.backgroundRole(), QBrush(QPixmap('back.png')))  # 設(shè)置背景圖片self.setPalette(palette1)def pre(self):out=pre(self.img,0)out=self.cv_qt(out)self.label_2.setPixmap(QPixmap.fromImage(out).scaled(self.label.width(),self.label.height(),QtCore.Qt.KeepAspectRatio))def pre2(self):out=pre(self.img,1)out=self.cv_qt(out)self.label_2.setPixmap(QPixmap.fromImage(out).scaled(self.label.width(),self.label.height(),QtCore.Qt.KeepAspectRatio))def pic(self):imgName, imgType = QFileDialog.getOpenFileName(self,"打開(kāi)圖片",""," *.png;;*.jpg;;*.jpeg;;*.bmp;;All Files (*)")#KeepAspectRatiopng = QtGui.QPixmap(imgName).scaled(self.label.width(),self.label.height(),QtCore.Qt.KeepAspectRatio)  # 適應(yīng)設(shè)計(jì)label時(shí)的大小self.label.setPixmap(png)self.img=Image.open(imgName)self.img=np.array(self.img)def cv_qt(self, src):#src必須為bgr格式圖像#src必須為bgr格式圖像#src必須為bgr格式圖像if len(src.shape)==2:src=np.expand_dims(src,axis=-1)src=np.tile(src,(1,1,3))h, w, d = src.shapeelse:h, w, d = src.shapebytesperline = d * w# self.src=cv.cvtColor(self.src,cv.COLOR_BGR2RGB)qt_image = QImage(src.data, w, h, bytesperline, QImage.Format_RGB888).rgbSwapped()return qt_imageif __name__ == '__main__':QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)app=QApplication(sys.argv)my=My()my.show()sys.exit(app.exec_())

項(xiàng)目結(jié)構(gòu):
在這里插入圖片描述
直接運(yùn)行main.py即可彈出交互界面。
項(xiàng)目下載地址:下載地址-列表第19

http://m.aloenet.com.cn/news/37417.html

相關(guān)文章:

  • 做金館長(zhǎng)網(wǎng)站網(wǎng)站寧寧網(wǎng)seo
  • 網(wǎng)站建設(shè)人才百度云怎么找資源
  • 任丘做網(wǎng)站現(xiàn)在什么app引流效果好
  • 北京疫情有多嚴(yán)重網(wǎng)站推廣優(yōu)化平臺(tái)
  • 樓盤(pán)銷(xiāo)售管理網(wǎng)站開(kāi)發(fā)資源官網(wǎng)關(guān)鍵詞優(yōu)化價(jià)格
  • 比價(jià)網(wǎng)官網(wǎng)安卓神級(jí)系統(tǒng)優(yōu)化工具
  • 常州市建設(shè)局網(wǎng)站專業(yè)的網(wǎng)站優(yōu)化公司排名
  • 競(jìng)價(jià)網(wǎng)站如何設(shè)計(jì)廣州seo優(yōu)化費(fèi)用
  • 各大招聘網(wǎng)站濟(jì)南百度推廣代理商
  • wordpress數(shù)據(jù)庫(kù)發(fā)布文章做網(wǎng)絡(luò)優(yōu)化哪家公司比較好
  • 可以做代發(fā)貨源的網(wǎng)站seo外包公司怎么樣
  • 公眾號(hào)做視頻網(wǎng)站會(huì)封嗎市場(chǎng)推廣方案范文
  • 建設(shè)一個(gè)網(wǎng)站需要什么西安網(wǎng)站seo費(fèi)用
  • 禪城網(wǎng)站建設(shè)報(bào)價(jià)網(wǎng)站首頁(yè)排名seo搜索優(yōu)化
  • 電子商務(wù)網(wǎng)站建設(shè)和管理的含義百度競(jìng)價(jià)登陸
  • vs網(wǎng)站畢業(yè)設(shè)計(jì)怎么做西安seo網(wǎng)絡(luò)推廣
  • b2b b2c 網(wǎng)站建設(shè)seo網(wǎng)站關(guān)鍵詞優(yōu)化多少錢(qián)
  • 做推送網(wǎng)站今天最新的新聞?lì)^條新聞
  • 有的網(wǎng)站打不開(kāi)是什么原因呢google搜索引擎入口下載
  • 網(wǎng)站站點(diǎn)創(chuàng)建成功了該怎么做外包公司為什么沒(méi)人去
  • 做視頻網(wǎng)站怎么備案百度競(jìng)價(jià)點(diǎn)擊軟件奔奔
  • seo與網(wǎng)站建設(shè)教師遭網(wǎng)課入侵直播錄屏曝光廣場(chǎng)舞
  • 大型服裝商城網(wǎng)站建設(shè)世界羽聯(lián)巡回賽總決賽
  • 高端手機(jī)網(wǎng)站百度圖片識(shí)別
  • 響應(yīng)式網(wǎng)站開(kāi)發(fā)視頻定制網(wǎng)站建設(shè)推廣服務(wù)
  • 網(wǎng)站數(shù)據(jù)庫(kù)空間增大企業(yè)網(wǎng)站推廣公司
  • 桂林旅游網(wǎng)seo關(guān)鍵詞布局
  • 賭粉在哪個(gè)平臺(tái)引流南昌seo
  • 南京網(wǎng)站制作百家號(hào)恢復(fù)正常百度
  • 經(jīng)營(yíng)性網(wǎng)站可以進(jìn)行非經(jīng)營(yíng)行網(wǎng)站備案嗎代刷網(wǎng)站推廣快速