当前位置:网站首页>激活函数公式、导数、图像笔记
激活函数公式、导数、图像笔记
2022-06-11 19:21:00 【秋山丶雪绪】
1. Sigmoid
公式: S i g m o i d ( x ) = 1 1 + e − x {\rm{Sigmoid}}(x)=\frac{1}{1+e^{-x}} Sigmoid(x)=1+e−x1
导数: S i g m o i d ′ ( x ) = S i g m o i d ( x ) ( 1 − S i g m o i d ( x ) ) {\rm{Sigmoid}}^{\prime}(x)={\rm{Sigmoid}}(x)(1-{\rm{Sigmoid}}(x)) Sigmoid′(x)=Sigmoid(x)(1−Sigmoid(x))

2. tanh
公式: t a n h ( x ) = e x − e − x e x + e − x {\rm{tanh}}(x)=\frac{e^x-e^{-x}}{e^x+e^{-x}} tanh(x)=ex+e−xex−e−x
导数: t a n h ′ ( x ) = 1 − t a n h 2 ( x ) {\rm{tanh}}^{\prime}(x)=1-{\rm{tanh}}^2(x) tanh′(x)=1−tanh2(x)

3. ReLU
公式: R e L U ( x ) = m a x ( 0 , x ) {\rm{ReLU}}(x)={\rm{max}}(0,x) ReLU(x)=max(0,x)
导数:
R e L U ′ ( x ) = { 1 , if x > 0 0 , if x < 0 {\rm{ReLU}}^{\prime}(x)= \begin{cases} 1, & \text{if $x>0$} \\ 0, & \text{if $x<0$} \end{cases} ReLU′(x)={ 1,0,if x>0if x<0

4. Leaky ReLU
公式: L e a k y R e L U ( x ) = m a x ( 0 , x ) + n e g a t i v e _ s l o p e ∗ m i n ( 0 , x ) {\rm{LeakyReLU}}(x)={\rm{max}}(0,x)+ {\rm{negative\_slope}}*{\rm{min}}(0,x) LeakyReLU(x)=max(0,x)+negative_slope∗min(0,x)
导数:
L e a k y R e L U ′ ( x ) = { 1 , if x > 0 n e g a t i v e _ s l o p e , if x < 0 {\rm{LeakyReLU}}^{\prime}(x)= \begin{cases} 1, & \text{if $x>0$} \\ {\rm{negative\_slope}}, & \text{if $x<0$} \end{cases} LeakyReLU′(x)={ 1,negative_slope,if x>0if x<0

5. Swish
公式: S w i s h ( x ) = x ∗ S i g m o i d ( β x ) {\rm{Swish}}(x)=x*{\rm{Sigmoid}}(\beta x) Swish(x)=x∗Sigmoid(βx)
class Swish(nn.Module):
def forward(self, x):
return x * torch.sigmoid(x)

6. Mish
公式: M i s h ( x ) = x ∗ t a n h ( l n ( 1 + e x ) ) {\rm{Mish}}(x)=x*{\rm{tanh}}(ln(1+e^x)) Mish(x)=x∗tanh(ln(1+ex))
class Mish(nn.Module):
def forward(self, x):
return x * F.softplus(x).tanh()

7. FReLU
FReLU 是专门为视觉任务设计的激活函数,将ReLU和PReLU扩展为2D激活函数,论文地址。
公式:
f ( x c , i , j ) = max ( x c , i , j , T ( x c , i , j ) ) T ( x c , i , j ) = x c , i , j ω ⋅ p c ω x c , i , j ω ⋅ p c ω = ∑ i − 1 ≤ h ≤ i + 1 , j − 1 ≤ w ≤ j + 1 x c , h , w ⋅ p c , h , w \begin{array}{c} f\left(x_{c, i, j}\right)=\max \left(x_{c, i, j}, \mathbb{T}\left(x_{c, i, j}\right)\right) \\ \\ \mathbb{T}\left(x_{c, i, j}\right)=x_{c, i, j}^{\omega} \cdot p_{c}^{\omega} \\ \\ x_{c, i, j}^{\omega} \cdot p_{c}^{\omega}=\sum\limits_{i-1 \leq h \leq i+1, j-1 \leq w \leq j+1} x_{c, h, w} \cdot p_{c, h, w} \end{array} f(xc,i,j)=max(xc,i,j,T(xc,i,j))T(xc,i,j)=xc,i,jω⋅pcωxc,i,jω⋅pcω=i−1≤h≤i+1,j−1≤w≤j+1∑xc,h,w⋅pc,h,w其中, x c , i , j x_{c, i, j} xc,i,j 代表需要激活的像素, c , i , j c,i,j c,i,j 对应 channel 和 2D 位置。
公式较为晦涩抽象,看论文中的图比较直观:
实际上就是将与 x x x 比大小的数 ( 0 , p x ) (0,px) (0,px) 替换为以 x x x 为中心的一个 3 × 3 3\times 3 3×3 卷积值,边角部分 padding 1。
为了防止混淆个人将其叫做激活核。
激活核的参数用高斯初始化,参与网络训练,对于 C C C 个通道的卷积输出,若用 3 × 3 3 \times 3 3×3 大小的激活核进行激活,则额外需要训练 C × 3 × 3 C \times 3 \times 3 C×3×3 个参数。文中尝试过平均池化和最大池化,都没有带参数的卷积效果好。
边栏推荐
- leetcode:剑指 Offer 56 - II. 数组中数字出现的次数 II【简单排序】
- CMU 15-445 database course lesson 5 text version - buffer pool
- Cf:b. array determinations
- cf:E. Price Maximization【排序 + 取mod + 双指针+ 配对】
- Pyramid test principle: 8 tips for writing unit tests
- What started mongodb? What are the application scenarios?
- Use Mysql to determine the day of the week
- 电子商务(njupt)
- 【Multisim仿真】利用运算放大器产生锯齿波
- 【信号去噪】基于FFT和FIR实现信号去噪附matlab代码
猜你喜欢

Specific methods for porting WinCC flexible 2008 project to botu WinCC

Automated test requirements analysis

CMU 15 - 445 cours de base de données Leçon 5 version texte - Pool tampon
![[untitled]](/img/02/49d333ba80bc6a3e699047c0c07632.png)
[untitled]
![Cf:e. price maximization [sort + take mod + double pointer + pair]](/img/a0/410f06fa234739a9654517485ce7a3.png)
Cf:e. price maximization [sort + take mod + double pointer + pair]

Gmail: how do I recall an outgoing message?

【图像去噪】基于马尔可夫随机场实现图像去噪附matlab代码
Function development of user information management
![Leetcode: sword finger offer 59 - ii Maximum value of queue [deque + sortedlist]](/img/6b/f2e04cd1f3aaa9fe057c292301894a.png)
Leetcode: sword finger offer 59 - ii Maximum value of queue [deque + sortedlist]

Introduction to go language (VI) -- loop statement
随机推荐
Cf:c. restoring the duration of tasks
Pymysql uses cursor operation database method to encapsulate!!!
[image denoising] image denoising based on Markov random field with matlab code
2022-2023 MEM pre approval interview notice of School of management, Xi'an Jiaotong University
WWDC22 开发者需要关注的重点内容
Flash ckeditor rich text compiler can upload and echo images of articles and solve the problem of path errors
【信号去噪】基于FFT和FIR实现信号去噪附matlab代码
Flink CDC 在大健云仓的实践
Web3 Games: exploring and reshaping the game experience
cf:C. Restoring the Duration of Tasks【找规律】
Undefined reference to 'g2o:: vertexe3:: vertexe3()'
CMU 15-445 数据库课程第五课文字版 - 缓冲池
Cf:e. price maximization [sort + take mod + double pointer + pair]
Judge whether it is a balanced binary tree
Key contents that wwdc22 developers need to pay attention to
Introduction to ieda bottom menu
PyMySQL利用游标操作数据库方法封装!!!
Experience of remote office communication under epidemic situation | community essay solicitation
[video denoising] video denoising based on salt with matlab code
使用图像处理技术和卷积神经网络(CNN)的作物病害检测