[FFmpeg-devel] [PATCH] libavfilter/dnn_native: Add multiple activation functions in dnn native

Liu Steven lq at chinaffmpeg.org
Wed May 22 05:28:52 EEST 2019



> 在 2019年5月21日,下午8:48,Guo, Yejun <yejun.guo at intel.com> 写道:
> 
> 
> 
>> -----Original Message-----
>> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of
>> Xuewei Meng
>> Sent: Tuesday, May 21, 2019 2:53 PM
>> To: ffmpeg-devel at ffmpeg.org
>> Subject: [FFmpeg-devel] [PATCH] libavfilter/dnn_native: Add multiple activation
>> functions in dnn native
>> 
>> Add "Leaky_relu" and "None" option in activation function.
>> 
>> Signed-off-by: Xuewei Meng <xwmeng96 at gmail.com>
>> ---
>> libavfilter/dnn_backend_native.c | 5 +++++
>> libavfilter/dnn_backend_native.h | 2 +-
>> 2 files changed, 6 insertions(+), 1 deletion(-)
> 
> LGTM
Pushed


Thanks
> 
>> 
>> diff --git a/libavfilter/dnn_backend_native.c b/libavfilter/dnn_backend_native.c
>> index fa3f20e4a2..3c8465a283 100644
>> --- a/libavfilter/dnn_backend_native.c
>> +++ b/libavfilter/dnn_backend_native.c
>> @@ -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;
>> diff --git a/libavfilter/dnn_backend_native.h b/libavfilter/dnn_backend_native.h
>> index d70cd16387..7e4e943137 100644
>> --- a/libavfilter/dnn_backend_native.h
>> +++ b/libavfilter/dnn_backend_native.h
>> @@ -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;
>> 
>> --
>> 2.17.1
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".





More information about the ffmpeg-devel mailing list