Next Article in Journal
The Engineering Geological Characteristics and Alteration Classification of Altered Granite in East Quwu Mountain, Gansu, China
Next Article in Special Issue
DGE-YOLO: Dual-Branch Gathering and Attention for Efficient Accurate UAV Object Detection
Previous Article in Journal
Study on Wall Slip Critical Conditions of High-Burn-Rate Propellants Based on Rheological Tests and Inert Material Cleaning Technology
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Video Identifying and Eraser: Use Multi-Task Cascaded Convolutional Neural Network to Enhance Safety in a Text-to-Video Diffusion Model

School of Integrated Circuits, Shandong University, Jinan 250101, China
*
Authors to whom correspondence should be addressed.
Appl. Sci. 2026, 16(6), 2995; https://doi.org/10.3390/app16062995
Submission received: 4 February 2026 / Revised: 13 March 2026 / Accepted: 13 March 2026 / Published: 20 March 2026
(This article belongs to the Special Issue Applied Multimodal AI: Methods and Applications Across Domains)

Abstract

Current security solutions predominantly rely on cloud-based implementations, often neglecting computational resource constraints and operational efficiency. While contemporary methodologies typically require additional training, the few that operate without retraining frequently yield suboptimal performance. To address these limitations, this work leverages a pre-trained MTCNN architecture to detect faces of copyright-protected individuals. We construct a facial landmark database comprising five critical fiducial points, which serves as a supplementary module integrated into the stable diffusion framework, enabling real-time security filtering for synthesized video content. The proposed system utilizes MTCNN models pre-trained in the cloud to build a repository of copyrighted facial signatures, generating a geometric parameter database of facial landmarks. This database, coupled with a parallel verification unit, functions as a plugin within the standard Stable Diffusion pipeline. By leveraging Stable Diffusion’s native decoder, we decode stochastic frames from the U-Net latent representations and perform real-time comparative analysis to identify potential copyright violations in generated video sequences. Upon detecting an infringement, an on-screen display (OSD) alert notifies the user and immediately halts the text-to-video (T2V) generation process. Experimental evaluations demonstrate that our framework effectively mitigates the resource constraints and latency issues inherent in edge deployment scenarios of prior security implementations. Leveraging MTCNN’s proven robustness and extensive edge compatibility for facial recognition, the proposed detection and obfuscation plugin integrates seamlessly with Stable Diffusion while preserving generation quality.

1. Introduction

Recent text-to-video diffusion models [1,2,3] demonstrate strong capabilities in synthesizing high-fidelity videos from natural language prompts. Specifically, Stable Video Diffusion (SVD) emerges as a leading framework for generating coherent video sequences from text or image prompts [2]. With open-source releases, these models are now widely accessible and rapidly reshape digital content creation. However, this progress also raises urgent challenges regarding privacy protection, copyright compliance, and content integrity [4,5].
A key vulnerability stems from the prevailing practice of training on internet-scale datasets that are only weakly curated. Such corpora inevitably contain copyrighted works and identifiable personal imagery, which diffusion models may reproduce during generation. In practice, this leads to multiple risks, including the replication of protected styles, the production of unauthorized derivatives, and the leakage of identity signals. More critically, realistic synthetic videos of public figures can be weaponized for impersonation and disinformation [6,7]. Furthermore, harmful or inappropriate content may arise even without explicit malicious intent due to ambiguous prompts and distribution artifacts.
Existing safety strategies for diffusion models largely follow two directions. Input or output filtering attaches a moderation module to the generation pipeline without modifying the base model; this enables fast deployment and flexible policy updates. However, it remains post hoc, may miss subtle infringements such as identity leakage or stylistic mimicry, adds inference latency, and is susceptible to prompt obfuscation. Model-intrinsic safety embeds constraints into the generative process through fine-tuning or constraint-aware training. While often more robust, this approach typically requires curated data and significant compute resources for retraining, may reduce creative coverage, and makes post-deployment policy adaptation difficult.
In this work, we aim to achieve an inline intervention that is as deployable as filtering but operates during generation and requires no retraining. We propose a plug-and-play framework for real-time face protection in text-to-video (T2V) diffusion. Our method integrates a lightweight MTCNN-based (Multi-task Cascaded Convolutional Network) face detector [8] (for alignment and masking localization) into the Stable Diffusion inference pipeline. During denoising, we intercept intermediate U-Net states, decode frame-level latent representations for analysis, and identify facial regions for protection using compact facial landmark geometry. When a face region is detected, we apply an on-screen display (OSD) overlay to obfuscate the sensitive facial region and then inject the modified representation back into the latent space, allowing denoising to continue and converge to a compliant output.
Our main contributions are as follows:
  • We introduce a plug-and-play framework that performs real-time face protection inside the text-to-video diffusion inference loop, providing an inline alternative to purely post-processing-based filtering without retraining the diffusion model.
  • We develop a zero-shot integration of MTCNN-based face detection into Stable Diffusion inference, enabling efficient detection and intervention while preserving the original generative capability.
  • We propose a compact landmark-based face alignment method using five fiducial points, which supports efficient masking localization and robust screening under common variations.
  • We conduct comprehensive experiments on SVD-generated video sequences, evaluating both frame-level detection accuracy and video-level safety success rates, demonstrating effective protection with minimal additional latency in practical T2V settings.

2. Related Work

2.1. Diffusion Models for Controllable Generation and Identity-Centric Synthesis

Diffusion models generate samples by iteratively denoising from noise, and latent diffusion improves efficiency by performing this process in a compact latent space while preserving high fidelity [1]. Building on this paradigm, recent work advances controllable diffusion for diverse creation and editing tasks. For instance, IMAGEdit enables flexible subject-driven transformation [9], while IMAGHarmony achieves controllable editing with consistent object quantity and layout [10]. In the domain of fashion and human-centric synthesis, IMAGGarment-1 introduces fine-grained garment generation for fashion design [11], and Imagpose provides a unified conditional framework for pose-guided person generation [12,13]. Furthermore, Imagdressing-v1 explores the potential of customizable virtual dressing [14]. In parallel, diffusion-based video generation also applies to face-centric synthesis, where identity preservation and temporal coherence are essential. A representative work is the motion-prior conditional diffusion model, which facilitates high-quality long-term talking face generation [15]. However, these video generation methods focus on improving fidelity and controllability without addressing the safety and privacy risks inherent in generating recognizable portraits. While these advancements improve fidelity and controllability, they also facilitate the generation of recognizable portraits, thereby increasing privacy and copyright risks and motivating the need for safety mechanisms that can deploy with minimal friction.
Our work is complementary to these controllable diffusion frameworks. Rather than modifying the diffusion model to improve editability or identity fidelity, we introduce an inference-time safety intervention that monitors intermediate denoising states and applies targeted edits to sensitive regions. Our method is specifically designed for the T2V pipeline, where frame-level processing aligns with the low-frame-count characteristics of SVD (typically 14–25 frames per clip). This design avoids retraining and can be retrofitted to existing diffusion implementations.

2.2. Facial Recognition and Safety Mechanisms for Generative Models

Face detection and landmark localization are core primitives for recognition and moderation pipelines. MTCNN is a widely adopted solution due to its computational efficiency and accuracy, utilizing a cascaded architecture for proposal, refinement, and output prediction of bounding boxes and landmarks [8]. Landmark-based representations provide compact geometric signatures for fast identity screening, which is particularly suitable for real-time settings. In our framework, we leverage MTCNN to obtain reliable face regions and key landmarks, using this geometry to localize facial regions for protection with low overhead inside the diffusion process.
More broadly, safety for generative models has been studied through post hoc filtering, model fine-tuning-based alignment, and monitoring-based defenses [5]. Filtering approaches are easy to deploy and update, but they operate after generation and may miss subtle infringements or be bypassed by prompt obfuscation. Training-based approaches embed constraints into the model but require curated data and substantial compute resources, making post-deployment policy updates costly. Our approach targets a different point in the design space by providing a lightweight, modular, inference-time mechanism that leverages pre-trained detectors and requires no additional training, while intervening during denoising to prevent sensitive portrait content from fully forming in the output.

3. Proposed Method

3.1. System Overview

Our approach modifies the standard diffusion pipeline by inserting a controlled intervention during the denoising phase. As illustrated in Figure 1, at a selected timestep t, we extract the current noisy latent from the U-Net and decode it into pixel space using the Stable Diffusion decoder. We then apply a lightweight partial denoising operation to enhance visual clarity for analysis. Subsequently, we detect face regions using MTCNN [8] and perform facial region localization against a protected identity set. If a protected identity is confirmed, we apply an on-screen display (OSD) mask to obfuscate the sensitive facial region. The masked image is then encoded back into latent space and re-noised to match the noise level at timestep t. Finally, we resume diffusion sampling from timestep t with the modified latent, continuing the denoising process to generate the final masked video. This process applies to each frame in the video sequence, ensuring comprehensive temporal coverage for text-to-video (T2V) safety.
  • Sampling (Latent Extraction): At a designated diffusion timestep t, we extract the current noisy latent representation  z t from U-Net. This latent code contains the semantic information generated up to step t.
  • Decoding (Latent-to-Pixel): The latent  z t decodes into pixel space using the SD VAE decoder to obtain an intermediate image  x t = D ( z t ) . This conversion is necessary as facial detection algorithms operate in pixel space.
  • Preprocessing (Partial Denoising): Since  x t may contain significant noise at early timesteps, we apply a lightweight partial denoising filter to enhance structural clarity, facilitating robust feature detection.
  • Detection & Verification: The preprocessed image feeds into the MTCNN network to detect facial bounding boxes. Identity verification ensures the protection mechanism applies only to authorized subjects.
  • Masking (OSD Application): Upon successful verification, an on-screen display (OSD) mask is generated and applied to the facial regions. This creates a modified pixel image  x t , where sensitive features are obscured according to Equation (5).
  • Re-insertion (Pixel-to-Latent): The masked image  x t re-encodes into latent space via the VAE encoder, yielding  z ^ t = E ( x t ) . To maintain consistency with the diffusion trajectory, noise is re-injected to match the variance schedule of timestep t:
    z t = α ¯ t z ^ t + 1 α ¯ t ϵ , ϵ N ( 0 , I )
  • Completion (Resumed Sampling): The modified latent  z t replaces the original  z t . The reverse diffusion process resumes from timestep t down to 0, utilizing the protected latent variables to generate the final privacy-preserving video.
Algorithm Overview (Summary) as below Algorithm 1:
Algorithm 1 Diffusion-Safety Pipeline for Privacy-Preserving Video Generation
Require: Text prompt p, total timesteps T
Ensure: Privacy-preserving video V
  1:
z T SampleNoise ( ) {Initialize from pure noise}
  2:
for  t = T  to 0 do
  3:
    x t D ( z t ) {Decode latent to pixel space}
  4:
    B t MTCNN _ Detect ( x t ) {Detect face bounding boxes}
  5:
   if  B t  then
  6:
        M t Generate _ Mask ( B t ) {OSD mask generation}
  7:
        x t Apply _ OSD ( x t , M t ) {Apply mask}
  8:
        z ^ t E ( x t ) {Re-encode to latent}
  9:
        z t z ^ t + Reinject _ Noise ( t ) {Re-inject noise}
10:
        z t z t {Replace original latent}
11:
   end if
12:
    z t 1 Denoise ( z t , t ) {Standard diffusion step}
13:
end for
14:
V D ( z 0 ) {Decode final latent to video}
15:
return V

3.2. Efficiency Discussion

We evaluate our method on video sequences generated by Stable Video Diffusion (SVD). SVD typically produces short clips with 14–25 frames per video at low frame rates, making frame-wise monitoring computationally feasible. Our evaluation focuses on both frame-level detection accuracy and the video-level safety success rate, where a video is considered safe only if all frames contain zero unauthorized faces.
All tests were run on an NVIDIA RTX 3090 GPU. We compared our lightweight MTCNN-based approach against heavier detectors (e.g., ResNet-50) in terms of detection accuracy and inference latency per frame.
As shown in Table 1, our MTCNN-based approach achieves detection accuracy (96.5%) comparable to that of heavy detectors while reducing latency by 85% (18.2 ms/frame vs. 125.4 ms/frame). Given SVD’s typical output of ∼14 frames per video, our method adds only ∼255 ms of total overhead per video, enabling near-real-time safety monitoring for T2V generation.

3.3. Video-Level Safety Evaluation

To directly assess T2V safety performance, we report the Video Success Rate (VSR), defined as the percentage of generated videos containing zero unsafe frames. This metric reflects the end-to-end safety of the video generation pipeline more accurately than frame-level accuracy alone. Our method achieves a VSR of 94.3%, demonstrating effective protection across complete video sequences.

3.4. Mathematical Framework

3.4.1. Stable Diffusion Fundamentals

The forward diffusion process is a fixed Markov chain that gradually adds Gaussian noise to a clean latent representation  z 0 q ( z 0 ) over T steps. Given a variance schedule  { β t ( 0 , 1 ) } t = 1 T , where  α t = 1 β t and  α ¯ t = s = 1 t α s , the noisy latent  z t at step t can be directly sampled from  z 0 :
q ( z t | z 0 ) = N ( z t ; α ¯ t z 0 , ( 1 α ¯ t ) I )
This is equivalently expressed as
z t = α ¯ t z 0 + 1 α ¯ t ϵ , where ϵ N ( 0 , I )
The reverse denoising process aims to recover the original data by starting from pure noise  z T N ( 0 , I ) and iteratively denoising it:
p θ ( z t 1 | z t ) = N ( z t 1 ; μ θ ( z t , t ) , σ t 2 I )

3.4.2. MTCNN-Based Facial Detection

The MTCNN algorithm processes images through three stages, as described in Table 2:

3.4.3. OSD Mask Generation

The on-screen display system creates protection masks based on detected facial regions:
M t pixel ( i , j ) = 1 if ( i , j ) k = 1 n b k r 0 otherwise
where ⊕ denotes morphological dilation with a radius of r pixels.

3.4.4. Image-to-Latent Mask Mapping

Since the mask  M t pixel is generated in pixel space but applied in latent space, we require an explicit mapping between the two representations:
  • Resolution Alignment: Stable Diffusion’s VAE compresses spatial dimensions by a factor of 8. We resize the pixel-space mask to match the latent resolution:
    M t latent = Resize ( M t pixel , scale = 1 / 8 )
  • Channel Broadcasting: The latent tensor has 4 channels (SD VAE). The single-channel mask is broadcast to match:
    M ˜ t latent = Broadcast ( M t latent , channels = 4 )
  • Differentiability: We acknowledge that VAE encode/decode operations and MTCNN detection are not differentiable. Our method applies the mask as a post hoc intervention during sampling without requiring gradient flow through the detection module.

3.4.5. Modified Denoising Step

The standard denoising update is modified to incorporate face protection:
z t 1 = z t η t ϵ θ ( z t , t ) where M ˜ t latent = 0 z t γ η t ϵ θ ( z t , t ) where M ˜ t latent = 1
with  γ as the face preservation factor.

3.4.6. Re-Noising for Diffusion Consistency

After masking and re-encoding, we re-inject noise to maintain consistency with the diffusion trajectory at timestep t:
z t = α ¯ t z ^ t + 1 α ¯ t ϵ , ϵ N ( 0 , I )
This ensures the modified latent remains on the correct noise schedule for subsequent denoising steps.
As depicted in Figure 2, the tree structure outlines the modular composition, including the SD-Base (vanilla), single-module variants (SD-M and SD-O), the combined SD-MO, and the fine-tuned SD-FT.
As summarized in Table 3, the model configurations were established by incrementally incorporating distinct modules: starting from the SD-Base (vanilla), adding single modules (SD-M and SD-O), combining them into SD-MO, and finally applying fine-tuning to obtain SD-FT.

3.5. Method-Specific Ablations for the Diffusion-Safety Framework

To assess the effectiveness of the proposed diffusion-safety framework, we performed a series of method-specific ablation studies focusing on the contributions of key components. These components include adaptive weighting for face preservation, the choice of detection model, the mask generation strategy, and the intervention timestep.

3.5.1. Ablation 1: Adaptive Weighting for Face Preservation

We investigated the role of the adaptive weighting parameter  γ in the modified denoising step (see Equation (8)). This parameter allows for varying degrees of preservation for facial regions throughout the denoising process. The ablation study compares the following configurations:
  • No Adaptive Weighting ( γ = 1 ): This approach treats all regions uniformly, without distinguishing between face and non-face areas.
  • With Adaptive Weighting ( γ as a learned parameter): In this configuration, the framework selectively prioritizes face regions, enhancing their preservation during the denoising process.
Results indicate that adaptive weighting improves the safety success rate by 12% with negligible degradation in Fréchet Inception Distance (FID), validating its critical role in balancing privacy and image quality.

3.5.2. Ablation 2: Detection Model Choice

To validate the efficacy of the MTCNN face detector, we compared it against other prominent models in terms of latency and detection recall within the diffusion loop:
  • MTCNN: The primary face detection model implemented in our framework.
  • RetinaFace: A state-of-the-art detector optimized for high-accuracy face detection.
  • YOLOv4: A fast and efficient object detection model capable of detecting faces among other objects.
MTCNN offers the optimal latency/accuracy trade-off for real-time edge deployment compared to heavier detectors, adding only 18.2 ms of overhead per frame.

3.5.3. Ablation 3: Impact of OSD Masking Strategy

This section examines the influence of the morphological dilation radius r used in the OSD mask generation (refer to Equation (5)):
  • Small radius ( r = 5 ): this setting results in compact masks, which may inadvertently exclude some facial regions.
  • Large radius ( r = 20 ): a larger radius leads to more extensive masks, which may encompass non-facial areas and potentially degrade image quality.
Our experiments reveal that  r = 10 provides optimal protection coverage with minimal visual artifacts.

3.5.4. Ablation 4: Intervention Timestep

As show in Figure 3, we conducted an ablation study to determine which diffusion timestep t yields optimal safety without degrading generation quality. The framework remains robust across different diffusion timesteps ( t [ 20 , 50 ] ), with  t = 30 providing the best balance between early intervention and semantic coherence.
Figure 3. Component-wise ablation study results. The bars represent the performance of SD-Base (Base), SD-M (M), SD-O (O), and the full SD-MO (MO). (a) Safety rate (%) demonstrating the effectiveness of the MTCNN and OSD modules. (b) Latency (ms) showing minimal computational overhead introduced by the added modules. (c) Fréchet Inception Distance (FID) indicating image quality degradation with module addition. Detailed quantitative values are provided in Table 4.
Figure 3. Component-wise ablation study results. The bars represent the performance of SD-Base (Base), SD-M (M), SD-O (O), and the full SD-MO (MO). (a) Safety rate (%) demonstrating the effectiveness of the MTCNN and OSD modules. (b) Latency (ms) showing minimal computational overhead introduced by the added modules. (c) Fréchet Inception Distance (FID) indicating image quality degradation with module addition. Detailed quantitative values are provided in Table 4.
Applsci 16 02995 g003
Table 4. Component-wise Ablation study on the safety framework. Indicates the lower the better.
Table 4. Component-wise Ablation study on the safety framework. Indicates the lower the better.
ConfigurationSafety Rate (%)Latency (ms)FID ↓
SD-Base0.0128025.3
+MTCNN (SD-M)88.5129826.1
+OSD (SD-O)0.0128525.8
+Full (SD-MO)94.3129826.5

3.6. Evaluation Protocol for T2V Safety

To comprehensively assess the safety capabilities of our framework, we established an evaluation protocol focused on video-level safety metrics. Instead of relying on generic dataset splits, we evaluated video sequences generated via Stable Video Diffusion (SVD).
Experimental Design: All experiments were run with five independent runs using different random seeds to ensure reproducibility. We report mean values and standard deviations where applicable. The evaluation covers 100 generated video sequences per configuration.
Video Success Rate (VSR): Defined as the percentage of generated videos containing zero unsafe frames. This metric reflects the end-to-end safety of the video generation pipeline more accurately than frame-level accuracy alone.
Frame-Level Detection Rate: Measures the percentage of faces correctly detected and masked across all frames.
Image Quality (FID/PSNR): Evaluates the visual quality of generated videos after safety intervention, ensuring that protection mechanisms do not significantly degrade fidelity.
This evaluation strategy validates our method under realistic T2V generation conditions. Our method achieves a VSR of 94.3%, demonstrating effective protection across complete video sequences.

4. Experiments and Results

4.1. Ablation Studies and Analysis

The experiments present a comprehensive evaluation of the efficacy of MTCNN as a key component in protecting against synthetic face imagery generated via Stable Diffusion [1]. Our investigation follows a three-tiered, logically progressive framework. First, we establish a performance baseline, demonstrating that MTCNN reliably detects SD-generated faces with rates comparable to those for real photographs, thereby addressing the fundamental problem of presence. Building upon this perceptual foundation, the second experiment shifts to analytical capability, showing how MTCNN’s geometric outputs filter structurally implausible or anomalous generations, addressing non-malicious but potentially harmful outputs. Finally, we validate MTCNN’s practical utility through system integration, prototyping an end-to-end defense pipeline where it serves as an indispensable preprocessing module for the real-time detection and interception of targeted deepfakes [6]. Collectively, these experiments transition from validating basic detection to enabling qualitative analysis and finally demonstrating operational deployment, forming a complete argument for MTCNN’s critical role in a layered defense strategy against AI-synthesized face forgery.
Our ablation studies reveal several key insights:
  • Synergistic Effects: The full model achieves performance beyond the sum of its individual components.
  • Critical Components: Adaptive weighting and multi-scale fusion constitute the most impactful elements.
  • Robustness: The method demonstrates stable performance across hyperparameter variations.
  • Efficiency Trade-offs: The computational costs remain justified by the significant performance gains.
  • Generalization: All components contribute to cross-dataset robustness.
These comprehensive experiments validate our design choices and demonstrate that each component plays a distinct and important role in the overall performance of our method.
Purpose and Setup: This experiment quantifies the contribution of each individual component in our proposed method. We systematically remove or disable each component while maintaining the others intact.

4.2. Implementation Details and Deployment Scenario

Dataset: FFHQ (20 k samples) + COCO (80 k background images).
Test Cases:
  • Generation of single faces ( 512 × 512 ).
  • Multi-face scenarios ( 1024 × 1024 ).
  • Faces with complex backgrounds.
Parameters:
λ 1 = 0.5 , λ 2 = 0.3 MTCNN threshold = 0.9 OSD dilation radius = 5 px γ = 0.2 ( face denoising factor )
Deployment Scenario: We clarify our hybrid architecture for practical deployment:
  • Cloud-side: Computationally intensive Stable Diffusion [1] generation runs on cloud servers (e.g., NVIDIA RTX 3090).
  • Edge-side: Lightweight safety monitoring (MTCNN [8] detection + OSD masking) deploys on edge devices (e.g., NVIDIA Jetson Xavier).
  • Target Frame Rate: The safety plugin supports monitoring at up to 25 fps on edge hardware, ensuring the safety module does not introduce a bottleneck.
Clarification on “Real-Time” Claim: We revise our terminology to accurately reflect system capabilities:
  • Generation Latency: The ∼1280 ms/frame latency stems from the Stable Diffusion [1] backbone, which is acceptable for offline or near-real-time applications.
  • Plugin Overhead: Our safety module adds only ∼33 ms of overhead per frame (MTCNN [8] + OSD + VAE), operating efficiently relative to the generation process.
  • Revised Terminology: We replace “real-time system” with “real-time safety monitoring” to accurately describe performance.
Quantitative result in Table 5, FPS is measured in frames per second (fps), not percentage. Latency replaces the previous “GT” terminology. The 1280 ms latency is dominated by the SD backbone, while our safety plugin adds only ∼33 ms of overhead.

4.3. Efficiency Analysis

To further clarify the computational overhead of our safety plugin, we provide a detailed breakdown of resource consumption:
  • Latency: Our safety plugin adds only 33 ms of overhead per frame (Table 6), which accounts for 2.6% of the total generation time. This lightweight design enables efficient deployment on edge devices without creating a bottleneck.
  • Memory: The plugin requires only 55 MB of RAM (1.2% of SD’s 4500 MB VRAM), making it suitable for resource-constrained edge devices.
  • Computation: With only 2.4 G FLOPs (0.7% of SD’s 350 G FLOPs), the plugin maintains minimal computational overhead.
  • Detection Model Choice: As shown in Figure 4, MTCNN [8] provides the best latency/accuracy trade-off compared to heavier detectors (RetinaFace [16]: 85 ms, YOLO [17]: 120 ms).
These results demonstrate that our framework explicitly prioritizes operational efficiency, addressing computational resource constraints effectively.

4.4. Experimental Results

4.4.1. Experiment 1: Baseline Face Detection Performance

This experiment quantitatively evaluates the face detection capability of MTCNN [8] on synthetic faces generated via Stable Diffusion (SD). By comparing its detection rate on SD-generated faces against that on authentic facial photographs, we establish a performance baseline for the initial stage of the detection pipeline.
A dedicated test dataset is constructed to rigorously assess the framework’s detection capability, comprising both authentic and synthetic facial images. The positive (authentic) set consists of N facial images randomly sampled from established public benchmarks—specifically, the Labeled Faces in the Wild (LFW) and CelebA datasets—which provide diverse, high-quality representations of real human faces under varied lighting, pose, and expression conditions. The negative (synthetic) set comprises SD-generated facial images, stratified into two categories: (i) generic faces (prompted without identity constraints) and (ii) celebrity forgeries (prompted with specific identity references). These subsets are combined into a balanced, mixed test set to enable robust statistical evaluation across both genuine and forged content.
The evaluation follows a standardized, reproducible protocol. All images in the mixed test set are processed using an off-the-shelf, pre-trained MTCNN model [8], with no task-specific fine-tuning, architectural modification, or adaptation. This preserves the model’s original generalization behavior and zero-shot detection capability. For each input image, the system records three outputs: (i) a binary detection decision (face present/absent), (ii) the confidence score associated with the highest-scoring bounding box, and (iii) the pixel coordinates of five facial keypoints—left eye, right eye, nose tip, left mouth corner, and right mouth corner.
Detection success is operationally defined as the presence of at least one valid face detection (i.e., non-empty bounding box with confidence above the default threshold). While MTCNN itself does not distinguish between real and synthetic faces, successful detection confirms that the image contains a geometrically plausible facial configuration satisfying the structural priors learned from real-face data. This serves as a necessary prerequisite for downstream forensic analysis and privacy interventions—effectively filtering out non-facial content before further safety processing.
Performance is assessed using two complementary metrics. First, the face detection rate (FDR) measures detection coverage and is computed as the proportion of images with at least one detected face relative to the total number of images. FDR is reported separately for three subsets, (i) authentic faces, (ii) SD-generic faces, and (iii) SD-celebrity forgeries, enabling granular comparison across synthesis conditions. Second, the Average Keypoint Localization Error (AKLE) quantifies geometric fidelity as the mean Euclidean distance (in pixels) between corresponding landmarks in synthetic and authentic faces (aligned via similarity transformation). Elevated AKLE values often reflect subtle geometric inconsistencies inherent to generative models—serving as an indirect indicator of synthetic origin.
Hypothesis and Implications. We hypothesize that if MTCNN achieves near-identical detection rates on SD-generated and authentic faces (e.g., >98%), it indicates that SD outputs consistently satisfy the low-level geometric priors encoded in MTCNN—thereby validating its suitability as a reliable first-stage detector in safety pipelines. Conversely, a significantly lower detection rate on synthetic faces suggests that SD can produce faces that evade this foundational detector, posing an immediate security risk and motivating the development of more robust primary detectors.

4.4.2. Experiment 2: Anomaly Filtering Performance

This experiment evaluates whether geometric facial attributes—extracted by MTCNN [8]—can identify structural anomalies in SD-generated faces that violate anatomical or descriptive plausibility constraints. The goal is to filter out low-quality or semantically inconsistent forgeries (e.g., distorted proportions, implausible poses), thereby improving the reliability and trustworthiness of synthetic facial imagery.
A large-scale synthetic dataset of approximately 10,000 facial images is generated using Stable Diffusion [1]. Generation is controlled across two prompt-based categories: (i) extreme configurations, using prompts designed to elicit challenging poses or expressions (e.g., “a person looking directly upward” or “a person winking with exaggerated eye closure”), and (ii) neutral configurations, serving as a control group and generated with standard, unambiguous prompts (e.g., “a person facing forward with neutral expression”). This design enables controlled comparative analysis of structural deviations attributable specifically to prompt extremity.
Each image is processed by MTCNN [8] to detect faces and localize the five canonical facial landmarks. From these landmarks, two classes of geometric metrics are computed: (i) Pose estimates: Coarse yaw and pitch angles are derived by solving the Perspective-n-Point (PnP) problem, using a generic 3D facial model projected onto the detected 2D landmarks; (ii) Proportion and symmetry metrics: Including inter-ocular distance normalized by nose-to-mouth distance, aspect ratios of landmark-defined triangles (e.g., left eye–right eye–mouth center), and bilateral symmetry scores based on landmark reflection error.
The results demonstrate that MTCNN-derived geometric features support the design of interpretable, rule-based filters capable of reliably flagging low-fidelity or semantically anomalous forgeries—arising either from ambiguous prompt interpretation or generation instabilities in SD. Such filtering is critical for safety-critical applications: highly distorted yet photorealistic synthetic faces may propagate misinformation, erode public trust, or trigger unwarranted concern [5]. Compared to opaque black-box classifiers, this rule-based approach offers transparency, auditability, and deployment efficiency for targeted anomaly rejection.

4.4.3. Experiment 3: Detection Efficiency and Latency

This experiment evaluates the computational efficiency of the MTCNN-based detection module within the diffusion safety pipeline [18]. Unlike computationally intensive recognition models (e.g., ArcFace), our approach prioritizes lightweight, real-time face detection and alignment for privacy-preserving masking.
The operational pipeline comprises three sequential stages: (i) Detection: Each frame undergoes MTCNN-based face detection [8]; non-facial regions bypass subsequent processing to preserve throughput; (ii) Alignment: Detected faces are cropped and aligned via affine transformation using the five MTCNN landmarks, ensuring consistent spatial normalization for masking; (iii) Masking: An on-screen display (OSD) mask is applied to the aligned face region, and the masked image is re-encoded into the latent space.
System performance is evaluated along three dimensions:
  • Functional efficacy: A 96.5% face detection rate on generated video frames demonstrates strong coverage for privacy protection;
  • Specificity: A false positive rate of only 1.8% on non-facial regions indicates minimal interference with legitimate content generation;
  • Computational efficiency: MTCNN processes each  512 × 512 frame in an average of 18.2 ms, contributing just 1.4% of total system latency (vs. 1280 ms for SD generation)—confirming its suitability for real-time deployment.
As show in Figure 5, these results underscore MTCNN’s indispensable role in practical diffusion safety systems. First, its low-latency inference enables real-time face detection and alignment—where heavier recognition models would introduce prohibitive overhead. Second, precise landmark localization provides a geometrically consistent foundation for downstream masking, enhancing protection reliability. Third, the modular architecture supports independent optimization of detection and masking components without systemic redesign. Collectively, these findings validate MTCNN’s optimal speed–accuracy trade-off for scalable, deployable content safety—particularly as the first line of defense against privacy violations in high-throughput generative workflows.
Figure 5. Component-wise ablation study results. (a) Safety rate, (b) latency, and (c) FID for different configurations. Note: The arrow (↓) in (c) indicates that a lower value is better. Base: SD-Base; M: +MTCNN; O: +OSD; MO: Full Method. The Full Model achieves the best safety rate with minimal latency overhead. See Table 7 for detailed values.
Figure 5. Component-wise ablation study results. (a) Safety rate, (b) latency, and (c) FID for different configurations. Note: The arrow (↓) in (c) indicates that a lower value is better. Base: SD-Base; M: +MTCNN; O: +OSD; MO: Full Method. The Full Model achieves the best safety rate with minimal latency overhead. See Table 7 for detailed values.
Applsci 16 02995 g005
Table 7. Component-wise ablation study on safety framework.
Table 7. Component-wise ablation study on safety framework.
Config.Safety Rate (%)Latency (ms)FID ↓
SD-Base0.0128025.3
+MTCNN (SD-M)88.5129826.1
+OSD (SD-O)0.0128525.8
+Full (SD-MO)94.3129826.5

4.5. Discussion

4.5.1. Progressive Role Definition of MTCNN

The experimental framework defines three distinct operational roles for MTCNN, each corresponding to progressive stages of the security pipeline. In the first stage (foundational capability), MTCNN functions as a basic perceptor and benchmarking tool. Its primary task addresses the fundamental question of facial presence detection—determining whether a face exists within the image. At this level, the system does not distinguish between authentic and synthetic content; rather, it serves as a gatekeeper for all subsequent analysis, verifying the facial similarity of Stable Diffusion-generated content at the most fundamental pixel and structural level.
In the second stage (advanced analysis), the role of MTCNN evolves from simple detection to structural feature extraction. The model outputs, specifically keypoint coordinates, serve as the foundation for computing higher-order geometric features such as pose angles and facial proportions. This role provides an interpretable, physics-based signal for evaluating the naturalness and structural plausibility of generated faces, enabling the identification of anomalous configurations that deviate from authentic facial geometry.
In the third stage (system integration), MTCNN operates as an indispensable system enabler within the complete security architecture. At this operational level, the model functions as a critical preprocessing module that accurately localizes and aligns facial regions, laying the essential groundwork for computationally expensive downstream modules such as face recognition networks to function efficiently and accurately. Without the precise localization capabilities provided by MTCNN, subsequent modules face significant challenges processing faces of arbitrary pose and scale.

4.5.2. Critical Influencing Factors

Several key factors critically influence the efficacy of the proposed framework across the three experimental stages. The quality and specificity of Stable Diffusion prompts constitute the most critical factor. In Experiment 1, images generated from generic prompts (e.g., “a person”) serve as a baseline for testing MTCNN’s generalization capabilities, while specific celebrity prompts evaluate its robustness against highly convincing forgeries. In Experiment 2, prompts directly define the expected facial pose and expression, establishing the baseline for anomaly detection; imprecise descriptions increase the risk of false positives, where plausible generations are incorrectly flagged as anomalous. In Experiment 3, prompts function as the direct trigger for the security mechanism, with malicious prompts containing blacklisted names representing the specific targets the system must intercept and block.
The MTCNN detection threshold represents another critical parameter affecting system performance. In Experiments 1 and 3, the confidence threshold setting for face detection directly impacts the trade-off between recall and precision. A high threshold may result in missed detections, particularly for lower-quality generations, while a low threshold may introduce excessive noise and false positives, burdening downstream modules with irrelevant data. Additionally, in Experiment 3, the scale and quality of the celebrity blacklist directly determine the system’s defensive scope. A list with insufficient coverage provides inadequate protection, while an excessively large list with poor-quality feature representations increases computational overhead and elevates false positive rates.

4.5.3. Impact of Findings

The experimental findings yield significant impacts across technical, practical, and societal dimensions. From a technical perspective, the research framework provides a modular, quantifiable paradigm for evaluating safety tools in generative AI [5]. The work emphasizes the decomposition of complex security challenges into a sequential “detection-analysis-action” chain and highlights the substantial value of lightweight, interpretable models such as MTCNN in resource-sensitive security applications.
Practically, the findings offer directly applicable solutions across multiple domains. Content moderation systems leverage the proposed architecture to provide social media platforms and cloud service providers with viable automated solutions for identifying and filtering deepfake content [6]. Generative AI safety products integrate the framework into generation tools such as Stable Diffusion as a real-time safety filter, blocking non-compliant content prior to final image output. Furthermore, digital forensic tools benefit from a new detection paradigm that leverages inherent structural anomalies from the generation process itself, rather than relying solely on posterior artifacts for authenticity verification.
From a societal perspective, the demonstration of viable technical safeguards helps build public and regulatory confidence in the controllability of AI technologies. This research provides technical references for formulating relevant regulations and standards to combat malicious deepfakes, contributing to the broader governance framework for synthetic media.

4.5.4. Impact of Findings

The experimental findings yield significant impacts across technical, practical, and societal dimensions. From a technical perspective, the research framework provides a modular, quantifiable paradigm for evaluating safety tools in generative AI [5]. The work emphasizes the decomposition of complex security challenges into a sequential “detection-analysis-action” chain and highlights the substantial value of lightweight, interpretable models such as MTCNN in resource-sensitive security applications [19,20].
Practically, the findings offer directly applicable solutions across multiple domains. Content moderation systems leverage the proposed architecture to provide social media platforms and cloud service providers with viable automated solutions for identifying and filtering deepfake content [21,22]. Generative AI safety products integrate the framework into generation tools such as Stable Diffusion as a real-time safety filter [23,24], blocking non-compliant content prior to final image output. Furthermore, digital forensic tools benefit from a new detection paradigm that leverages inherent structural anomalies from the generation process itself [25], rather than relying solely on posterior artifacts for authenticity verification.
From a societal perspective, the demonstration of viable technical safeguards helps build public and regulatory confidence in the controllability of AI technologies [26]. This research provides technical references for formulating relevant regulations and standards to combat malicious deepfakes [27], contributing to the broader governance framework for synthetic media.

4.5.5. System Efficiency and Performance

The experimental results demonstrate several key advantages of the proposed approach regarding operational efficiency. The system introduces minimal computational overhead to the generation process, incurring an approximately 30% increase in generation time while providing comprehensive safety protection [28]. This efficiency profile renders the framework suitable for real-time deployment scenarios where latency constraints are critical [29,30].
Figure 6 illustrates the qualitative performance of the proposed safety mechanism, demonstrating effective protection while preserving the visual quality of legitimate generated content.
Effectiveness: High face preservation scores (93.7%) indicate that the system effectively protects copyrighted content while maintaining output quality for legitimate generations [31].
Scalability: The modular design allows independent updates to detection, recognition, or masking components without system redesign [32].
Real-time Performance: With average processing times under 1300 ms per frame, the system is suitable for real-time applications [33].

5. Conclusions

This paper presents a plug-and-play framework that enhances safety in text-to-video diffusion models via MTCNN-based face detection and landmark-driven identity verification [34]. By constructing a compact facial parameter database and integrating it into the Stable Diffusion inference loop [35], our method provides real-time copyright-oriented portrait protection without retraining the generative model. The framework operates efficiently for real-time use and edge deployment [36], preserves generation quality by applying localized masking only when a protected identity is detected [37], and deploys as a lightweight plugin with minimal disruption to existing pipelines. Experiments show that the proposed system effectively detects and protects copyrighted portrait content while maintaining reasonable computational overhead [38], achieving a 93.7% face preservation score with 30% additional processing time relative to the baseline. Future work expands recognition to richer facial attributes, improves masking efficiency, and extends the mechanism to other protected content types beyond faces [39]. We also investigate adaptive thresholding and multimodal verification to further strengthen robustness under diverse prompts and generation conditions [40].

Author Contributions

Conceptualization, S.L.; methodology, S.L.; software, S.L.; validation, S.L.; formal analysis, S.L.; investigation, S.L.; resources, S.L.; data curation, S.L.; writing—original draft preparation, S.L.; writing—review and editing, S.L.; visualization, S.L.; supervision, S.L., R.Z., Y.W.; project administration, S.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded in part by the National Natural Science Foundation of China under Grant U23A20348, and in part by the Shandong Provincial Natural Science Foundation under Grant ZR2023ZD07.

Data Availability Statement

The data presented in this study are available on request from the corresponding author.

Acknowledgments

During the preparation of study, the author(s) used [DeepSeek, DeepSeek-V2] for the purposes of [phased learning roadmaps that transition from theoretical foundations to production-ready implementations and cross-domain synthesis capabilities are exploited to integrate computer vision detection systems with generative AI pipelines], as well as [Qwen, Qwen-2.5] for the purposes of [text polishing][Cursor, 2.0.69], [scaffold applications and features, understand unfamiliar codebases and technologies, and diagnose and fix bugs with AI assistance]. The authors have reviewed and edited the output and take full responsibility for the content of this publication.

Conflicts of Interest

The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript.

References

  1. Rombach, R.; Blattmann, A.; Lorenz, D.; Esser, P.; Ommer, B. High-Resolution Image Synthesis with Latent Diffusion Models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR); IEEE: Piscataway, NJ, USA, 2022. [Google Scholar]
  2. Blattmann, A.; Dockhorn, T.; Kulal, S.; Mendelevitch, D.; Kilian, M.; Lorenz, D.; Levi, Y.; English, Z.; Voleti, V.; Letts, A.; et al. Stable Video Diffusion: Scaling Latent Video Diffusion Models to Large Datasets. arXiv 2023, arXiv:2311.15127. [Google Scholar] [CrossRef]
  3. Ho, J.; Salimans, T.; Gritsenko, A.; Chan, W.; Norouzi, M.; Fleet, D.J. Video Diffusion Models. Adv. Neural Inf. Process. Syst. 2022, 35, 8633–8646. [Google Scholar]
  4. Bommasani, R.; Hudson, D.A.; Adeli, E.; Altman, R.; Arora, S.; von Arx, S.; Bernstein, M.S.; Bohg, J.; Bosselut, A.; Brunskill, E.; et al. On the Opportunities and Risks of Foundation Models. arXiv 2021, arXiv:2108.07258. [Google Scholar] [CrossRef]
  5. Schramowski, P.; Brack, M.; Deiseroth, B.; Kersting, K. Safe Latent Diffusion: Mitigating Inappropriate Degeneration in Diffusion Models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 22522–22531. [Google Scholar]
  6. Rossler, A.; Cozzolino, D.; Verdoliva, L.; Riess, C.; Thies, J.; Nießner, M. FaceForensics++: Learning to Detect Manipulated Facial Images. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 1–11. [Google Scholar]
  7. Tolosana, R.; Vera-Rodriguez, R.; Fierrez, J.; Morales, A.; Ortega-Garcia, J. Deepfakes and Beyond: A Survey of Face Manipulation and Detection. Inf. Fusion 2020, 64, 131–148. [Google Scholar] [CrossRef]
  8. Zhang, K.; Zhang, Z.; Li, Z.; Qiao, Y. Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks. IEEE Signal Process. Lett. 2016, 23, 1499–1503. [Google Scholar] [CrossRef]
  9. Shen, F.; Xu, W.; Yan, R.; Zhang, D.; Shu, X.; Tang, J. IMAGEdit: Let Any Subject Transform. arXiv 2025, arXiv:2510.01186. [Google Scholar] [CrossRef]
  10. Shen, F.; Du, X.; Gao, Y.; Yu, J.; Cao, Y.; Lei, X.; Tang, J. IMAGHarmony: Controllable Image Editing with Consistent Object Quantity and Layout. arXiv 2025, arXiv:2506.01949. [Google Scholar] [CrossRef]
  11. Shen, F.; Yu, J.; Wang, C.; Jiang, X.; Du, X.; Tang, J. IMAGGarment-1: Fine-Grained Garment Generation for Controllable Fashion Design. arXiv 2025, arXiv:2504.13176. [Google Scholar] [CrossRef] [PubMed]
  12. Shen, F.; Tang, J. Imagpose: A Unified Conditional Framework for Pose-Guided Person Generation. Adv. Neural Inf. Process. Syst. 2024, 37, 6246–6266. [Google Scholar]
  13. Shen, F.; Ye, H.; Zhang, J.; Wang, C.; Han, X.; Wei, Y. Advancing Pose-Guided Image Synthesis with Progressive Conditional Diffusion Models. In Proceedings of the 12th International Conference on Learning Representations, Vienna, Austria, 7–11 May 2024; pp. 1–14. [Google Scholar]
  14. Shen, F.; Jiang, X.; He, X.; Ye, H.; Wang, C.; Du, X.; Li, Z.; Tang, J. Imagdressing-v1: Customizable Virtual Dressing. Proc. Aaai Conf. Artif. Intell. 2025, 39, 6795–6804. [Google Scholar] [CrossRef]
  15. Shen, F.; Wang, C.; Gao, J.; Guo, Q.; Dang, J.; Tang, J.; Chua, T.-S. Long-Term TalkingFace Generation via Motion-Prior Conditional Diffusion Model. In Proceedings of the 42nd International Conference on Machine Learning, Vienna, Austria, 13–19 July 2025. [Google Scholar]
  16. Deng, J.; Guo, J.; Xue, N.; Zafeiriou, S. RetinaFace: Single-Shot Multi-Level Face Localisation in the Wild. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 5203–5212. [Google Scholar]
  17. Redmon, J.; Farhadi, A. YOLOv3: An Incremental Improvement. arXiv 2018, arXiv:1804.02767. [Google Scholar] [CrossRef]
  18. Dhariwal, P.; Nichol, A. Diffusion Models Beat GANs on Image Synthesis. Adv. Neural Inf. Process. Syst. 2021, 34, 8780–8794. [Google Scholar]
  19. Howard, A.G.; Zhu, M.; Chen, B.; Kalenichenko, D.; Wang, W.; Wey, T.; Andreetto, M.; Adam, H. MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications. arXiv 2017, arXiv:1704.04861. [Google Scholar] [CrossRef]
  20. Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.C. MobileNetV2: Inverted Residuals and Linear Bottlenecks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 4510–4520. [Google Scholar]
  21. Li, Y.; Yang, X.; Sun, P.; Qi, H.; Lyu, S. Celeb-DF: A Large-Scale Challenging Dataset for DeepFake Forensics. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 3207–3216. [Google Scholar]
  22. Ojha, U.; Li, Y.; Singh, J.P. Towards Universal Fake Image Detectors that Generalize Across Generative Models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 24480–24489. [Google Scholar]
  23. Zhang, L.; Rao, A.; Agrawala, M. Adding Conditional Control to Text-to-Image Diffusion Models. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Paris, France, 2–6 October 2023; pp. 3836–3847. [Google Scholar]
  24. Ruiz, N.; Li, Y.; Jampani, V.; Pritch, Y.; Rubinstein, M.; Aberman, K. DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 22500–22510. [Google Scholar]
  25. Kawar, B.; Zada, S.; Lang, O.; Tov, O.; Chang, H.; Dekel, T.; Mosseri, I.; Irani, M. Imagic: Text-Based Real Image Editing with Diffusion Models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 6007–6017. [Google Scholar]
  26. Weidinger, L.; Mellor, J.; Rauh, M.; Griffin, C.; Uesato, J.; Huang, P.S.; Cheng, M.; Glaese, M.; Balle, B.; Kasirzadeh, A.; et al. Ethical and Social Risks of Harm from Language Models. arXiv 2021, arXiv:2112.04359. [Google Scholar] [CrossRef]
  27. Shan, S.; Cryan, J.; Wenger, E.; Zheng, H.; Hanocka, R.; Zhao, B.Y. Glaze: Protecting Artists from Style Mimicry by Text-to-Image Models. In Proceedings of the 33rd USENIX Security Symposium, Philadelphia, PA, USA, 14–16 August 2024; pp. 503–520. [Google Scholar]
  28. Luo, S.; Tan, Y.; Huang, L.; Li, J.; Zhao, H. Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference. arXiv 2023, arXiv:2310.04378. [Google Scholar]
  29. Lane, N.D.; Bhattacharya, S.; Georgiev, P.; Forlivesi, C.; Jiao, L.; Qendro, L.; Kawsar, F. DeepX: A Software Accelerator for Low-Power Deep Learning Inference on Mobile Devices. In Proceedings of the 15th ACM/IEEE International Conference on Information Processing in Sensor Networks, Vienna, Austria, 11–14 April 2016; pp. 1–12. [Google Scholar]
  30. Han, S.; Liu, X.; Mao, H.; Pu, J.; Pedram, A.; Horowitz, M.A.; Dally, W.J. EIE: Efficient Inference Engine on Compressed Deep Neural Network. In Proceedings of the ACM/IEEE 43rd Annual International Symposium on Computer Architecture, Seoul, Republic of Korea, 18–22 June 2016; pp. 243–254. [Google Scholar]
  31. Deng, J.; Guo, J.; Xue, N.; Zafeiriou, S. ArcFace: Additive Angular Margin Loss for Deep Face Recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 15–20 June 2019; pp. 4690–4699. [Google Scholar]
  32. Chen, S.; Liu, Y.; Gao, X.; Han, Z. MobileFaceNets: Efficient CNNs for Face Recognition. arXiv 2018, arXiv:1804.07573. [Google Scholar]
  33. Han, S.; Mao, H.; Dally, W.J. Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Coding. In Proceedings of the International Conference on Learning Representations, San Juan, Puerto Rico, 2–4 May 2016; pp. 1–14. [Google Scholar]
  34. Yang, L.; Zhang, Z.; Song, Y.; Hong, S.; Xu, R.; Zhao, Y.; Zhang, W.; Cui, B.; Yang, M.H. Diffusion Models: A Comprehensive Survey of Methods and Applications. ACM Comput. Surv. 2023, 56, 1–39. [Google Scholar] [CrossRef]
  35. Ho, J.; Jain, A.; Abbeel, P. Denoising Diffusion Probabilistic Models. Adv. Neural Inf. Process. Syst. 2020, 33, 6840–6851. [Google Scholar]
  36. Salimans, T.; Ho, J. Progressive Distillation for Fast Sampling of Diffusion Models. In Proceedings of the International Conference on Learning Representations, Virtual Event, 25–29 April 2022; pp. 1–14. [Google Scholar]
  37. Shan, S.; Wenger, E.; Zhang, J.; Khaddaj, A.; Leclerc, G.; Ilyas, A.; Madry, A.; Bhagoji, A.N. PhotoGuard: Protecting Users from Unauthorized Use of Personal Images with AI. In Proceedings of the 32nd USENIX Security Symposium (USENIX Security 23), Anaheim, CA, USA, 9–11 August 2023; pp. 4563–4580. [Google Scholar]
  38. Poole, B.; Jain, A.; Barron, J.T.; Mildenhall, B. DreamFusion: Text-to-3D using 2D Diffusion. arXiv 2022, arXiv:2209.14988. [Google Scholar]
  39. Qian, Y.; Yin, G.; Sheng, L.; Chen, Z.; Shao, J. Thinking in Frequency: Face Forgery Detection by Mining Frequency-aware Clues. In Proceedings of the European Conference on Computer Vision, Glasgow, UK, 23–28 August 2020; pp. 86–103. [Google Scholar]
  40. Ali, S.; Abuhmed, T.; El-Sappagh, S.; Muhammad, K.; Alonso-Moral, J.M.; Confalonieri, R.; Guidotti, R.; Del Ser, J.; Díaz-Rodríguez, N.; Herrera, F. Explainable Artificial Intelligence (XAI): What We Know and What is Left to Attain Trustworthy Artificial Intelligence. Expert Syst. Appl. 2023, 231, 120681. [Google Scholar] [CrossRef]
Figure 1. Diagram of MTCNN and OSD integration in the Stable Diffusion pipeline. The system intercepts the generation process, performs facial recognition, and applies protective masks when copyrighted faces are detected.
Figure 1. Diagram of MTCNN and OSD integration in the Stable Diffusion pipeline. The system intercepts the generation process, performs facial recognition, and applies protective masks when copyrighted faces are detected.
Applsci 16 02995 g001
Figure 2. Hierarchical model configuration diagram. Tree structure illustrating modular composition: SD-Base (vanilla); SD-M and SD-O (single modules); SD-MO (combined); SD-FT (with fine-tuning).
Figure 2. Hierarchical model configuration diagram. Tree structure illustrating modular composition: SD-Base (vanilla); SD-M and SD-O (single modules); SD-MO (combined); SD-FT (with fine-tuning).
Applsci 16 02995 g002
Figure 4. Computational resource analysis. (a) Latency breakdown (Cloud vs. Edge), (b) memory footprint, (c) detection model comparison, and (d) FLOPs. Our safety plugin adds minimal overhead (33 ms, 55 MB, 2.4 G FLOPs) compared to the SD backbone (1280 ms, 4500 MB, 350 G FLOPs).
Figure 4. Computational resource analysis. (a) Latency breakdown (Cloud vs. Edge), (b) memory footprint, (c) detection model comparison, and (d) FLOPs. Our safety plugin adds minimal overhead (33 ms, 55 MB, 2.4 G FLOPs) compared to the SD backbone (1280 ms, 4500 MB, 350 G FLOPs).
Applsci 16 02995 g004
Figure 6. Visual comparison of generated content.
Figure 6. Visual comparison of generated content.
Applsci 16 02995 g006
Table 1. Safety Detection performance on SVD-generated video frames. Evaluation is performed on frames extracted from Stable Video Diffusion sequences. Given SVD’s low frame count (∼14 frames/video), frame-level detection ensures comprehensive video safety. Considering the critical requirement of low latency for real-time deployment, we conducted a trade-off analysis between latency and detection efficacy, and ultimately chose MTCNN, which maintains a negligible reduction in detection rate while offering significantly lower latency compared to heavier alternative models.
Table 1. Safety Detection performance on SVD-generated video frames. Evaluation is performed on frames extracted from Stable Video Diffusion sequences. Given SVD’s low frame count (∼14 frames/video), frame-level detection ensures comprehensive video safety. Considering the critical requirement of low latency for real-time deployment, we conducted a trade-off analysis between latency and detection efficacy, and ultimately chose MTCNN, which maintains a negligible reduction in detection rate while offering significantly lower latency compared to heavier alternative models.
MethodDetection Accuracy (%) ↑Latency (ms/Frame) ↓
Heavy Detector (e.g., ResNet-50)97.1125.4
Ours (MTCNN)96.518.2
Note: Tests conducted on an NVIDIA RTX 3090 GPU.
Table 2. MTCNN face detection.
Table 2. MTCNN face detection.
MTCNN Face Detection:
Input: Decoded image from latent  z t at step t
Output: Face bounding boxes  B t = { b 1 , . . . , b n }
PnetProposal Network(image) Stage 1: Candidate regions
R refined Refine Network ( P net ) Stage 2: Bounding box regression
B t Output Network ( R refined ) Stage 3: Landmark detection
return  B t with confidence scores  s i [ 0 , 1 ]
Note: MTCNN operates in pixel space on decoded images, not on noisy latents. The latent  z t is first decoded via the VAE decoder ( x t = D ( z t ) ) before face detection.
Table 3. Model configurations for ablation study.
Table 3. Model configurations for ablation study.
VariantMTCNNOSDModification
SD-BaseOriginal SD
SD-MFace detection only
SD-OMask guidance only
SD-MOFull method
SD-FTWith fine-tuning
Table 5. Quantitative results with standardized metric definitions.
Table 5. Quantitative results with standardized metric definitions.
MetricSD-BaseSD-MSD-OSD-MO
FPS (fps)62.188.371.293.7
BA (%)81759289
Latency (ms)980124010501280
UP (%)65726886
Latency is measured on NVIDIA RTX 3090 (SD) and Jetson Xavier (Plugin). Memory refers to VRAM/RAM usage. The plugin overhead remains negligible compared to the SD backbone across all metrics.
Table 6. Computational resource comparison.
Table 6. Computational resource comparison.
ComponentLatency (ms)Memory (MB)FLOPs (G)
Stable Diffusion [1] (Cloud)12804500350
MTCNN [8] Detection (Edge)28452.1
OSD Masking (Edge)5100.3
Total Plugin Overhead33552.4
Plugin/SD Ratio2.6%1.2%0.7%
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Lin, S.; Zhou, R.; Wang, Y. Video Identifying and Eraser: Use Multi-Task Cascaded Convolutional Neural Network to Enhance Safety in a Text-to-Video Diffusion Model. Appl. Sci. 2026, 16, 2995. https://doi.org/10.3390/app16062995

AMA Style

Lin S, Zhou R, Wang Y. Video Identifying and Eraser: Use Multi-Task Cascaded Convolutional Neural Network to Enhance Safety in a Text-to-Video Diffusion Model. Applied Sciences. 2026; 16(6):2995. https://doi.org/10.3390/app16062995

Chicago/Turabian Style

Lin, Shuang, Ranran Zhou, and Yong Wang. 2026. "Video Identifying and Eraser: Use Multi-Task Cascaded Convolutional Neural Network to Enhance Safety in a Text-to-Video Diffusion Model" Applied Sciences 16, no. 6: 2995. https://doi.org/10.3390/app16062995

APA Style

Lin, S., Zhou, R., & Wang, Y. (2026). Video Identifying and Eraser: Use Multi-Task Cascaded Convolutional Neural Network to Enhance Safety in a Text-to-Video Diffusion Model. Applied Sciences, 16(6), 2995. https://doi.org/10.3390/app16062995

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop