Swish

1 개요

이미지 채널 값의 Swish(Sigmoid Linear Unit, SiLU) 함숫값 또는 미분값을 반환하는 알고리즘입니다.

Swish
Graph
Fig. Plot of Swish function.

2 알고리즘 상세 설명

Forward 모드

Source 이미지 픽셀 각 채널 값의 Swish 함숫값을 계산하여 출력합니다.
아래의 Figure 는 [-1, 1] 범위의 float 이미지에 β=10.0\beta = 10.0 을 적용한 예시를 보여줍니다.

Source Image Destination Image
Source Image Destination Image
Fig. Source and destination images. (forward mode)

yn=Swishβ(xn)=xnSigmoid(βxn)y_{n} = \text{Swish}_{\beta}(x_{n}) = x_{n}\text{Sigmoid}(\beta x_{n})

Swishβ(x)=x1+eβx\text{Swish}_{\beta}(x) = \frac{x}{1+e^{-\beta x}}

Backward 모드

Source 이미지 픽셀 각 채널 값의 Swish 미분값을 계산하여 출력합니다.
아래의 Figure 는 [-1, 1] 범위의 float 이미지에 β=10.0\beta = 10.0 을 적용한 예시를 보여줍니다.

Source Image Destination Image
Source Image Destination Image
Fig. Source and destination images. (backward mode)

yn=Swishβ(xn)y_{n} = \text{Swish}'_{\beta}(x_{n})

Swishα(x)=11+eβx(1+βxeβx1+eβx)\text{Swish}'_{\alpha}(x) = \frac{1}{1+e^{-\beta x}}(1 + \frac{\beta x e^{-\beta x}}{1+e^{-\beta x}})

3 파라미터 설정 및 사용 방법

Operation Mode 설정

Beta 설정

4 예제 코드

COperationSwish swish;

CFLImage fliSourceImage;
CFLImage fliDestinationImage;

swish.SetSourceImage(fliSourceImage);
swish.SetDestinationImage(fliDestinationImage);
swish.SetOperationMode(COperationSwish::EOperationMode_Forward);
swish.SetBeta(10.0);

swish.Execute();
COperationSwish swish = new COperationSwish();

CFLImage fliSourceImage = new CFLImage();
CFLImage fliDestinationImage = new CFLImage();

swish.SetSourceImage(ref fliSourceImage);
swish.SetDestinationImage(ref fliDestinationImage);
swish.SetOperationMode(COperationSwish.EOperationMode.Forward);
swish.SetBeta(10.0);

swish.Execute();

5 기타 사항

Supported Feature

Supported Format

Overflow Method

Overflow 가 발생하는 경우 Clamping 처리 됩니다.

6 관련 알고리즘

ReLU PReLU ELU Softplus Sigmoid Mish Soft Shrinkage Hard Shrinkage