当前位置:网站首页>Reappearance of ASPP (atlas spatial pyramid pooling) code
Reappearance of ASPP (atlas spatial pyramid pooling) code
2022-07-03 18:21:00 【ZRX_ GIS】
import torch
import torch.nn as nn
import torch.nn.functional as F
class ASPP(nn.Module):
def __init__(self, in_channels, out_channels):
super(ASPP, self).__init__()
dilations = [1, 6, 12, 18]
self.layer1 = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=1,
padding=0, dilation=dilations[0], bias=False),
nn.BatchNorm2d(out_channels), nn.ReLU()
)
self.layer2 = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1,
padding=dilations[1], dilation=dilations[1], bias=False),
nn.BatchNorm2d(out_channels), nn.ReLU()
)
self.layer3 = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1,
padding=dilations[2], dilation=dilations[2], bias=False),
nn.BatchNorm2d(out_channels), nn.ReLU()
)
self.layer4 = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1,
padding=dilations[3], dilation=dilations[3], bias=False),
nn.BatchNorm2d(out_channels), nn.ReLU()
)
self.layer5 = nn.Sequential(
nn.AdaptiveAvgPool2d((1, 1)),
nn.Conv2d(2048, 256, 1, stride=1, bias=False),
nn.BatchNorm2d(256),
nn.ReLU()
)
self.conv = nn.Conv2d(1280,256,1,bias=False)
self.batch_nor = nn.BatchNorm2d(256)
def forward(self,x):
x1 = self.layer1(x)
x2 = self.layer2(x)
x3 = self.layer3(x)
x4 = self.layer4(x)
x5 = self.layer5(x)
x5 = F.interpolate(x5,size=x1.size()[2:],mode='nilinear',align_corners=True)
x = torch.cat((x1,x2,x3,x4,x5),dim=1)
return x
边栏推荐
- As soon as we enter "remote", we will never regret, and several people will be happy and several people will be sad| Community essay solicitation
- A. Odd Selection【BruteForce】
- Redis core technology and practice - learning notes (VII) sentinel mechanism
- An academic paper sharing and approval system based on PHP for computer graduation design
- Change the single node of Postgres database into master-slave
- [linux]centos 7 reports an error when installing MySQL "no package MySQL server available" no package ZABBIX server MySQL available
- 圖像24比特深度轉8比特深度
- Module 9 operation
- 毕业总结
- Redis core technology and practice - learning notes (VIII) sentinel cluster: sentinel hung up
猜你喜欢

Module 9 operation

(8) HS corner detection

How to expand the capacity of golang slice slice

Global and Chinese health care OEM and ODM market status survey and investment planning recommendations report 2022-2028

PHP MySQL create database

4. Load balancing and dynamic static separation

Ml (machine learning) softmax function to realize the classification of simple movie categories

How to deploy applications on kubernetes cluster

PHP MySQL inserts multiple pieces of data

Redis core technology and practice - learning notes (VI) how to achieve data consistency between master and slave Libraries
随机推荐
AcWing 271. 杨老师的照相排列【多维DP】
Win 11 major updates, new features love love.
Win32: analyse du fichier dump pour la défaillance du tas
A. Berland Poker &1000【简单数学思维】
Global and Chinese pediatric palliative care drug market development research and investment planning recommendations report 2022-2028
Redis cache avalanche, penetration, breakdown
[combinatorics] generating function (example of using generating function to solve the number of solutions of indefinite equation)
Bloom filter [proposed by bloom in 1970; redis cache penetration solution]
[教程]在 CoreOS 上构建你的第一个应用
Keepalived setting does not preempt resources
[combinatorics] generating function (positive integer splitting | basic model of positive integer splitting | disordered splitting with restrictions)
网格图中递增路径的数目[dfs逆向路径+记忆dfs]
Graduation summary
win32:堆破坏的dump文件分析
PHP MySQL reads data
Supervisor monitors gearman tasks
How to deploy applications on kubernetes cluster
Keepalived 设置不抢占资源
2022-2028 global lithium battery copper foil industry research and trend analysis report
2022-2028 global marking ink industry research and trend analysis report