From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 1CE884D8F2 for ; Wed, 26 Feb 2025 14:17:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 66EFB68CD11; Wed, 26 Feb 2025 16:17:21 +0200 (EET) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F173068C971 for ; Wed, 26 Feb 2025 16:17:14 +0200 (EET) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-439a4fc2d65so67633675e9.3 for ; Wed, 26 Feb 2025 06:17:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740579434; x=1741184234; darn=ffmpeg.org; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=hPT/nnnap/21Cirlwf9oPGa11gj0vTRjNRsyeVufEQg=; b=mWSL1gBNHWfOZCjGQSIiKDmSDjrUghenSqe78tkgg4WVfsJmK3OXwJ1jSp1Z7itc+0 CBr11Zu2R9hgRMOWaZb8I+hdGR3I3greYMG4iJXqOr5iKoFwBPBYzlMdSbC0YD+25U46 c6eSfbhxPluRsQeTiBBcCJYlWhdXuh3xUaQYSl1FnX9L5OfXL3TFWvCuMPqKdFf6RXhO kpzP2Xq5ZUgCyRBQr8dnezBX8wyRUQFAchB+y7peMmnHw1637TVzJPZcX5kQ0Y6RJDZC IIgfHpwyN9kRNGuVzqsBXlS9XeJWjaOkpD3Sh+WoIhd1hcNDIvnMvwX6xgeo8q4U0Dll EguA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740579434; x=1741184234; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=hPT/nnnap/21Cirlwf9oPGa11gj0vTRjNRsyeVufEQg=; b=TYH7AWVBrj7yhFMbgf5jc2nT4WQs23KrMdsvY73MC9fwiZMuU9/po6n8AqMtI8DBVS pupkJd7jvsYDYJKPiwiVSiwsfugi2yFDNIRgYsd1ReebWL4ooJ8epxFO0q2TBVw43l9Z moe5XKnK6TMV4A0yo+XJNBeNYN8ezUWMfZZE//fjk+EqIyC5u8AsbdZlQAEf+ztiQw+N +oiFB76Cg7nG+T7z59BSZhn3D3XeNDDVfKzg6jpGoGSTpY5sM3VPsuDimhWWnPG9TLNh IirdMUR2nQTZ2G8Xpze+29aohEkFKVy/595d6QM0H8TyKRNbcpCbzDimzPvkSJ1hvpOw vPJg== X-Gm-Message-State: AOJu0YyR6l5etZbpCO0/sPl1PH+g0XXgTtxDXKmlbd2dEFnYs2XULt0z woSLGPVm/pC2sMLtQTBn4VrDffeh8TQAHwhew3yhQoqhUS5es14KJTplCQ== X-Gm-Gg: ASbGncvgBqWoh0p8SJ/W+BmVizaxCPFyIjQLRJV79CyszuEU6dOdVKpM712pzN18e/Q li/vsAiP14x2cxIPdAr4oE8BTpuPytclRCKVxiB1adbl9FMHOBhUefZ7XHkM3UR1dCEJmWTvC7y DZ0awDK1pAsjD8UHCbzZyZp2gxkflY1Ut8nIVW3MbLasoqaRL2XOftmiwPzaTYo6mW2Jdxutqus 6kQs9v6pPy7vbO3Q5OAXhLZcBIv8JOJsE0qg0nNAqdm9wUlCZwFKg/jB4B2WCszC4p9UbOVf19F QGtsid+Ps5scst+1hZyUl4OtzturoUoAMXnQMu92NpqmQVoDxfuogfcs9TUXl+7XM/mVylSXUsq Lf9i2 X-Google-Smtp-Source: AGHT+IFPf9ZBCKfW8it+ZeMf3QyXiYVsGoiiBvwec/X44iITA8HbKjwM7Qq4kjXinLwi+HFsMpqGEw== X-Received: by 2002:a05:600c:1c06:b0:439:8bc3:a6a3 with SMTP id 5b1f17b1804b1-43ab0f2561amr78085655e9.3.1740579433916; Wed, 26 Feb 2025 06:17:13 -0800 (PST) Received: from ?IPV6:2001:9e8:1d8b:5400:78d5:4c81:c4fb:f3ab? ([2001:9e8:1d8b:5400:78d5:4c81:c4fb:f3ab]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43aba549da9sm23110415e9.38.2025.02.26.06.17.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Feb 2025 06:17:13 -0800 (PST) Message-ID: <86f226c0-ea73-410a-8ba7-5e416faf0a59@gmail.com> Date: Wed, 26 Feb 2025 15:17:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Leandro Santiago To: ffmpeg-devel@ffmpeg.org Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] avfilter/dnn_detect: fail on filter if mandatory anchor option is missing X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: It prevents the filter of running in case such option is missing, failing early, during init() instead of simply logging an error during runtime. It depends on this other change: https://patchwork.ffmpeg.org/project/ffmpeg/patch/6c4d8098-bb57-4f7c-b86b-9221492b7ced@gmail.com/ Signed-off-by: Leandro Santiago --- libavfilter/vf_dnn_detect.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c index cd70c64e98..bc9a1777ff 100644 --- a/libavfilter/vf_dnn_detect.c +++ b/libavfilter/vf_dnn_detect.c @@ -173,11 +173,6 @@ static int dnn_detect_parse_yolo_output(AVFrame *frame, DNNData *output, int out return AVERROR(EINVAL); } - if (!anchors) { - av_log(filter_ctx, AV_LOG_ERROR, "anchors is not set\n"); - return AVERROR(EINVAL); - } - if (output[output_index].dims[1] * output[output_index].dims[2] * output[output_index].dims[3] % (box_size * cell_w * cell_h)) { av_log(filter_ctx, AV_LOG_ERROR, "wrong cell_w, cell_h or nb_classes\n"); @@ -656,6 +651,14 @@ static av_cold int dnn_detect_init(AVFilterContext *context) DnnDetectContext *ctx = context->priv; DnnContext *dnn_ctx = &ctx->dnnctx; int ret; + int using_yolo = (ctx->model_type == DDMT_YOLOV3 || + ctx->model_type == DDMT_YOLOV4 || + ctx->model_type == DDMT_YOLOV1V2); + + if (using_yolo && !ctx->anchors) { + av_log(ctx, AV_LOG_ERROR, "anchors is not set while being required for YOLO models\n"); + return AVERROR(EINVAL); + } ret = ff_dnn_init(&ctx->dnnctx, DFT_ANALYTICS_DETECT, context); if (ret < 0) -- 2.48.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".