PR #24189 opened by Raja-89
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24189
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24189.patch

This patch introduces the first automated FATE tests for the LibTorch DNN 
backend.
It adds a new `dnn.mak` configuration to test basic inference and batch 
processing. The tests use a tiny identity TorchScript model 
(`identity_torch.pt`) to compare output CRCs deterministically.
I have emailed the required `identity_torch.pt` sample model to 
`[email protected]`. Once it is uploaded to 
`fate-suite/dnn_processing/`, these tests will pass on the CI.

Signed-off-by: Raja Rathour <[email protected]>



>From 41bc14e6a33e5dfb7677dc9bc6fc5de0133e6685 Mon Sep 17 00:00:00 2001
From: Raja-89 <[email protected]>
Date: Tue, 11 Aug 2026 15:47:52 +0530
Subject: [PATCH] fate/dnn: add FATE tests for LibTorch DNN backend

Add the first automated regression tests for the dnn_processing filter
using the LibTorch backend.

A new dnn.mak file is created with tests that use a tiny identity
TorchScript model (identity_torch.pt) returning its input unchanged,
allowing deterministic framecrc comparison. The tests use rgbtestsrc
as the input source to avoid requiring auto_conversion_filters.

Tests added:
- fate-filter-dnn-processing-torch-rgb24: single-frame inference
- fate-filter-dnn-processing-torch-batch: batch_size=2 inference

The identity_torch.pt model needs to be uploaded to the FATE sample
server under fate-suite/dnn_processing/.

Signed-off-by: Raja Rathour <[email protected]>
---
 tests/Makefile                                   |  1 +
 tests/fate/dnn.mak                               | 14 ++++++++++++++
 tests/ref/fate/filter-dnn-processing-torch-batch |  7 +++++++
 tests/ref/fate/filter-dnn-processing-torch-rgb24 |  6 ++++++
 4 files changed, 28 insertions(+)
 create mode 100644 tests/fate/dnn.mak
 create mode 100644 tests/ref/fate/filter-dnn-processing-torch-batch
 create mode 100644 tests/ref/fate/filter-dnn-processing-torch-rgb24

diff --git a/tests/Makefile b/tests/Makefile
index 3f0132dd97..0b8e001e16 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -179,6 +179,7 @@ include $(SRC_PATH)/tests/fate/dashenc.mak
 include $(SRC_PATH)/tests/fate/dca.mak
 include $(SRC_PATH)/tests/fate/demux.mak
 include $(SRC_PATH)/tests/fate/dfa.mak
+include $(SRC_PATH)/tests/fate/dnn.mak
 include $(SRC_PATH)/tests/fate/dnxhd.mak
 include $(SRC_PATH)/tests/fate/dpcm.mak
 include $(SRC_PATH)/tests/fate/dvvideo.mak
diff --git a/tests/fate/dnn.mak b/tests/fate/dnn.mak
new file mode 100644
index 0000000000..4045eb4185
--- /dev/null
+++ b/tests/fate/dnn.mak
@@ -0,0 +1,14 @@
+# DNN processing filter tests (LibTorch backend)
+#
+# These tests use a tiny identity TorchScript model that returns
+# its input unchanged, so the output CRC must match what the
+# rgbtestsrc filter alone would produce.
+
+FATE_DNN_TORCH += fate-filter-dnn-processing-torch-rgb24
+fate-filter-dnn-processing-torch-rgb24: CMD = framecrc -lavfi 
"rgbtestsrc=rate=1:duration=1:size=32x32,dnn_processing=dnn_backend=torch:model=$(TARGET_SAMPLES)/dnn_processing/identity_torch.pt"
+
+FATE_DNN_TORCH += fate-filter-dnn-processing-torch-batch
+fate-filter-dnn-processing-torch-batch: CMD = framecrc -lavfi 
"rgbtestsrc=rate=2:duration=1:size=32x32,dnn_processing=dnn_backend=torch:model=$(TARGET_SAMPLES)/dnn_processing/identity_torch.pt:batch_size=2"
+
+FATE_SAMPLES_FFMPEG-$(call ALLYES, DNN_PROCESSING_FILTER LIBTORCH) += 
$(FATE_DNN_TORCH)
+fate-dnn: $(FATE_DNN_TORCH)
diff --git a/tests/ref/fate/filter-dnn-processing-torch-batch 
b/tests/ref/fate/filter-dnn-processing-torch-batch
new file mode 100644
index 0000000000..4651061760
--- /dev/null
+++ b/tests/ref/fate/filter-dnn-processing-torch-batch
@@ -0,0 +1,7 @@
+#tb 0: 1/2
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 32x32
+#sar 0: 1/1
+0,          0,          0,        1,     3072, 0x9d0ff00f
+0,          1,          1,        1,     3072, 0x9d0ff00f
diff --git a/tests/ref/fate/filter-dnn-processing-torch-rgb24 
b/tests/ref/fate/filter-dnn-processing-torch-rgb24
new file mode 100644
index 0000000000..cfe8f6c7c7
--- /dev/null
+++ b/tests/ref/fate/filter-dnn-processing-torch-rgb24
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 32x32
+#sar 0: 1/1
+0,          0,          0,        1,     3072, 0x9d0ff00f
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to