From patchwork Wed Jan 17 07:21:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Wenbin" X-Patchwork-Id: 45624 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c58a:b0:199:de12:6fa6 with SMTP id gn10csp185565pzb; Tue, 16 Jan 2024 23:22:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqVx0ywcMj9rlaL+K3Gnz9t8w5yndfnPqoT/J2t8AvxAFN3D3Sa7ZsVLaIIWKWSxd76aS4 X-Received: by 2002:a05:6402:110a:b0:559:d2eb:1c15 with SMTP id u10-20020a056402110a00b00559d2eb1c15mr285424edv.24.1705476146690; Tue, 16 Jan 2024 23:22:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705476146; cv=none; d=google.com; s=arc-20160816; b=mk+X6aTWfy8eLQSvjFdCpGjGwjeiRLFtkGEgqwg1K02Cr7MrOPkrkrqAtUVbMuelN4 edP7JnVW8ywcdUSrAa/nCzzBoTSd2GLdpxxTmv+9I9tHX5gLRqwBWy8AYhZaSBgGMAX1 EgNSrYLoV49GcJEC8nePS/+QtcJypJ+QNqLeCEuMlK1+nUN46+T3vw1E3rjgpBkkaT/+ VLWlFPNQxKwqcGogGNa9N+SzNnUVssM458STaLGwfCjKpJbHiDcLBMp0COydGekaCduT 25LVNmgzBZCJIEgk2LnR03tc0Kki673GrH8O7pCrkca0HgSQTmqf0N75TePN84qdEW6N PvYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=wVjWTqKKdbAqMD3wQS0748zqxxTXwHvI4obh/5fYi1k=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=vgFmGYvXTq6z28Lox4RXEtjZ76lXd1pdu7Ylxc+4+QaAnfjU12/P0EyDCSoBc0lcPZ 4Mv+o13V8yPd+9KDAinOLXWPViG8Qx1L1TUBMHZrppqyo89IijPv/4Wl46t5AsazJKOi yxY1/CKdPis6CnlrMhW3VLt3RRc/GG1GSgQSMRZ5Norm82CqLVnSaS33k5jCiHDCuDd7 99LYNMxy5lfdp2Iw6NuwWdjk2NnozF3nedbDD/FrtNM05uO8EqGGF3eLIT1O/bDLMdH5 TFLGDUxgOwu4dgQQcBla9ruoIV+KVI+RpmuA5WFboRk4kvmE7z7dfpvBFgGDVwzHcQBy 8X/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=ntba49rW; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t5-20020a50d705000000b005536465920asi5530198edi.389.2024.01.16.23.22.26; Tue, 16 Jan 2024 23:22:26 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=ntba49rW; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CC95F68D041; Wed, 17 Jan 2024 09:22:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4E19F68D041 for ; Wed, 17 Jan 2024 09:22:05 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705476131; x=1737012131; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=oRdKpEeZB2/dGtMtFlPlGKholIVdh+7a6AL/XjZyRLk=; b=ntba49rW6Xrjxskriz19bn2JfkTV5fKbJU2BdYte15eao7w3sZQVGBs1 mOpW6jJRf8orO8l8LHgTYXCzEiRI9KpIUXPouWGlul0lksqMKa9D/WfRO jXBiihdgRl9yqDGKxljjPzivt7obpP4YxbmqWtvr71C+s7vVBcCSERhb8 XYjRD1YS20AFXNgzTLlHbs/o7UxW4YtKgj5M4dgjmdrIz1REMKz7uInwg 4mpjIWSka++CkPQYR3zARi2cVYQe4EjamLlknB639nktyz/2mhr+B0lTS UAa/7lgVVdXak/aZk+OHDpa9HzMFsVySaP6ol9Ag9nd4MLb3zabvXDzac g==; X-IronPort-AV: E=McAfee;i="6600,9927,10955"; a="6850317" X-IronPort-AV: E=Sophos;i="6.05,200,1701158400"; d="scan'208";a="6850317" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2024 23:21:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10955"; a="1031256787" X-IronPort-AV: E=Sophos;i="6.05,200,1701158400"; d="scan'208";a="1031256787" Received: from wenbin-z390-aorus-ultra.sh.intel.com ([10.239.156.43]) by fmsmga006.fm.intel.com with ESMTP; 16 Jan 2024 23:21:55 -0800 From: wenbin.chen-at-intel.com@ffmpeg.org To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Jan 2024 15:21:51 +0800 Message-Id: <20240117072151.2155795-3-wenbin.chen@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240117072151.2155795-1-wenbin.chen@intel.com> References: <20240117072151.2155795-1-wenbin.chen@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] libavfilter/vf_dnn_detect: Use class confidence to filt boxes 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: CwUI3AFVGP5F From: Wenbin Chen Use class confidence instead of box_score to filt boxes, which is more accurate. Class confidence is obtained by multiplying class probability distribution and box_score. Signed-off-by: Wenbin Chen --- libavfilter/vf_dnn_detect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c index caccbf7a12..2bf5ed7476 100644 --- a/libavfilter/vf_dnn_detect.c +++ b/libavfilter/vf_dnn_detect.c @@ -236,9 +236,6 @@ static int dnn_detect_parse_yolo_output(AVFrame *frame, DNNData *output, int out conf = post_process_raw_data( detection_boxes_data[cy * cell_w + cx + 4 * cell_w * cell_h]); } - if (conf < conf_threshold) { - continue; - } if (is_NHWC) { x = post_process_raw_data(detection_boxes_data[0]); @@ -257,6 +254,9 @@ static int dnn_detect_parse_yolo_output(AVFrame *frame, DNNData *output, int out conf = conf * post_process_raw_data( detection_boxes_data[cy * cell_w + cx + (label_id + 5) * cell_w * cell_h]); } + if (conf < conf_threshold) { + continue; + } bbox = av_mallocz(sizeof(*bbox)); if (!bbox)