1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

libavfilter/dnn_native: Add multiple activation functions in dnn native

Add "Leaky_relu" and "None" option in activation function.

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Xuewei Meng <xwmeng96@gmail.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
This commit is contained in:
Xuewei Meng 2019-05-21 14:52:49 +08:00 committed by Steven Liu
parent e45e6005ce
commit ecc096513c
2 changed files with 6 additions and 1 deletions

View File

@ -270,6 +270,11 @@ static void convolve(const float *input, float *output, const ConvolutionalParam
break;
case SIGMOID:
output[n_filter] = 1.0f / (1.0f + exp(-output[n_filter]));
break;
case NONE:
break;
case LEAKY_RELU:
output[n_filter] = FFMAX(output[n_filter], 0.0) + 0.2 * FFMIN(output[n_filter], 0.0);
}
}
output += conv_params->output_num;

View File

@ -32,7 +32,7 @@
typedef enum {INPUT, CONV, DEPTH_TO_SPACE} DNNLayerType;
typedef enum {RELU, TANH, SIGMOID} DNNActivationFunc;
typedef enum {RELU, TANH, SIGMOID, NONE, LEAKY_RELU} DNNActivationFunc;
typedef enum {VALID, SAME, SAME_CLAMP_TO_EDGE} DNNConvPaddingParam;