[FFmpeg-devel] [PATCH] avfilter/vf_dnn_detect: fix loading anchors when labels file is set

Guo, Yejun yejun.guo at intel.com
Sat Jan 4 15:15:04 EET 2025



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Leandro Santiago
> Sent: Tuesday, December 31, 2024 2:53 AM
> To: ffmpeg-devel at ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH] avfilter/vf_dnn_detect: fix loading anchors
> when labels file is set
> 
> References https://trac.ffmpeg.org/ticket/11387
> 
> Defining anchors is needed, even when a filename with the labels is set.
> The issue was identified when using yolov4-tiny model using openvino.
> 
> More information about how to reproduce the bug can be found on the trac
> issue referenced by this commit.
> 
> Signed-off-by: Leandro Santiago <leandrosansilva at gmail.com>
> ---
>  libavfilter/vf_dnn_detect.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c index
> f4abd38ec1..09e4c69c18 100644
> --- a/libavfilter/vf_dnn_detect.c
> +++ b/libavfilter/vf_dnn_detect.c
> @@ -695,8 +695,12 @@ static av_cold int dnn_detect_init(AVFilterContext
> *context)
>      ff_dnn_set_detect_post_proc(&ctx->dnnctx, dnn_detect_post_proc);
> 
>      if (ctx->labels_filename) {
> -        return read_detect_label_file(context);
> +        ret = read_detect_label_file(context);
> +        if (ret) {
> +          return ret;
> +        }
>      }
> +
>      if (ctx->anchors_str) {
>          ret = dnn_detect_parse_anchors(ctx->anchors_str, &ctx->anchors);
>          if (!ctx->anchors) {
> @@ -705,6 +709,7 @@ static av_cold int dnn_detect_init(AVFilterContext
> *context)
>          }
>          ctx->nb_anchor = ret;
>      }
> +
>      return 0;
>  }
> 
LGTM, will push soon.


More information about the ffmpeg-devel mailing list