baheesa/inter_frame_forgery_detection

GitHub: baheesa/inter_frame_forgery_detection

基于TCN与Stacking集成学习的帧间视频伪造检测代码库,用于识别并分类视频中的帧插入、删除和复制篡改。

Stars: 0 | Forks: 0

# 增强的帧间视频伪造检测 ### 卷积网络 · Stacking 集成 来自我们 Springer 论文(《Multimedia Tools and Applications》,2026)的 Python 代码
[![论文](https://img.shields.io/badge/Paper-Springer-0F4C81?style=flat-square)](https://link.springer.com/article/10.1007/s11042-026-21684-x) [![DOI](https://img.shields.io/badge/DOI-10.1007%2Fs11042--026--21684--x-blue?style=flat-square)](https://doi.org/10.1007/s11042-026-21684-x) [![Python](https://img.shields.io/badge/Python-3.8%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/) [![TensorFlow](https://img.shields.io/badge/TensorFlow-2.x-FF6F00?style=flat-square&logo=tensorflow&logoColor=white)](https://www.tensorflow.org/) [![OpenCV](https://img.shields.io/badge/OpenCV-4.x-5C3EE8?style=flat-square&logo=opencv&logoColor=white)](https://opencv.org/) 剪辑者可以通过插入、删除或复制帧来更改视频的时间线——通常还会进行进一步的后期处理,使剪切痕迹难以察觉。本代码库实现了一个五阶段的 pipeline,用于在静态和动态视频中标记这些时间维度上的伪造,并将每个视频分类为**原始**、**帧插入**、**帧删除**或**帧复制**。
[LinkedIn](https://www.linkedin.com/in/baheesafatima/) · [ResearchGate](https://www.researchgate.net/profile/Baheesa-Fatima-2) · [ORCID](https://orcid.org/0009-0003-2757-5672) · [电子邮件](mailto:baheesafatima@gmail.com)
**关键词:** 帧间视频伪造检测 · 视频伪造检测 · 数字视频取证 · 帧插入 · 帧删除 · 帧复制 · 时间维度伪造 · Stacking 集成 · 时间卷积网络 · TCN · 光流法 · HOG · 边缘差异 · 多媒体取证 · 被动取证 · 视频篡改检测 · TensorFlow · OpenCV · VFD · TDTVD · VIFFD ## 项目简介 剪辑者可以通过**插入**、**删除**或**复制**帧来更改视频的时间线——通常还会进行进一步的后期处理,使剪切痕迹难以察觉。这种编辑被称为**帧间视频伪造**(也称为时间维度伪造或视频篡改)。 本代码库是我们关于**帧间视频伪造检测**与分类论文的官方 Python 实现: 该五阶段 pipeline 可在静态和动态视频中标记时间维度上的伪造,并将每个视频分类为**原始**、**帧插入**、**帧删除**或**帧复制**。 **报告的 F1 分数:** VFD **0.994** · TDTVD **0.975** · VIFFD **0.940** 如果您在自己的工作中使用了此代码或方法,请注明引用——非常感谢。 ## 方法 该方法将经典的视频线索与深度时间编码和 ensemble 分类器相结合:

Inter-frame video forgery detection pipeline: preprocessing, edge difference optical flow HOG features, TCN encoding, stacking ensemble classification, and forgery localisation

论文中的图 1 —— 预处理、特征提取、TCN 编码、Stacking 分类和定位。

| 阶段 | 处理内容 | |:-----:|--------------| | **1** | **预处理** — 将帧转换为灰度图、去噪(NLM)、锐化、归一化,并可选择进行数据增强 | | **2** | **特征** — 提取边缘差异(**D**)、光流法(**O**)和 HOG(**H**)作为互补的伪造线索 | | **3** | **TCN 编码** — 将拼接后的特征映射为固定的 **64-D** 时间维度表示(Conv1D + LSTM) | | **4** | **分类** — 使用带有逻辑回归元分类器的 RF、GBoost、SVM 和 kNN 的 Stacking 集成模型 | | **5** | **定位** — 小波直方图差异(∆w)+ Otsu 阈值处理,用于标记伪造的帧范围 | 本代码库实现了第 **1–4** 阶段(加上一个标注步骤)。第 **5** 阶段在论文(§2.2.5)中有所描述。 ## 环境配置 ``` git clone https://github.com/baheesa/inter_frame_forgery_detection.git cd inter_frame_forgery_detection python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt ``` ### 数据布局 按类别文件夹整理视频(父文件夹的名称即为标签): ``` / original/ insert/ delete/ duplicate/ ``` 支持的格式:`.mp4`, `.avi`, `.mov`。 ### 运行 pipeline 在每个脚本的 `main()` 中编辑绝对路径,使其指向您的数据集。请在所有四个脚本中保持 `split_data` 标志**一致**。 ``` python annotate.py # write annotation JSON from the folder layout python preprocess_extract.py # preprocess frames and extract D / O / H python tcn_feat.py # encode features with the TCN → 64-D vectors python ensemble_class.py # train / evaluate the stacking ensemble ``` | 脚本 | 输入 | 输出 | |--------|-------|--------| | `annotate.py` | 视频文件夹 | `output/annotations/*_annotate.json` | | `preprocess_extract.py` | 标注文件 | `output/*_preprocess_feat.json` | | `tcn_feat.py` | 预处理 JSON | `output/*_tcn.npy` | | `ensemble_class.py` | 标注文件 + TCN `.npy` | `output/stacking_model.pkl`, 评估指标 | ## 数据集 在三个公开的**视频伪造检测**基准数据集上进行了评估: | 数据集 | 链接 | 备注 | |---------|------|-------| | **VFD** | [Kaggle](https://www.kaggle.com/datasets/rajshah1/video-forgery--dataset) | 最大的数据集 · 包含静态和动态视频 | | **TDTVD** | [论文](https://doi.org/10.1007/s11042-020-09205-w) | 时间维度伪造 · 单一和多重伪造 | | **VIFFD** | [Mendeley](https://data.mendeley.com/) | 主要为静态视频 · 多分辨率 | 在论文中,VIFFD 和 TDTVD 是通过从不相交的真实样本中受控生成的,从而保证了训练集和测试集之间不会发生数据泄露。完整方案请参阅文章。 ## 引用 如果您使用了此代码或方法,请引用: ``` @article{Fatima2026InterFrame, title = {Enhanced inter-frame video forgery detection using convolutional network and stacking ensemble}, author = {Fatima, Baheesa and Bakhshi, Asim Dilawar and Ghafoor, Abdul}, journal = {Multimedia Tools and Applications}, volume = {85}, pages = {497}, year = {2026}, doi = {10.1007/s11042-026-21684-x} } ``` ## 作者 伊斯兰堡国家科技大学(NUST) **Baheesa Fatima** · **Asim Dilawar Bakhshi**(通讯作者) · **Abdul Ghafoor**

Gmail NUST LinkedIn ResearchGate ORCID

通讯作者:[asim.dilawar@mcs.edu.pk](mailto:asim.dilawar@mcs.edu.pk) ## 许可协议 发布用于学术研究和可复现性——如果使用了这项工作,请引用本论文。图 1 和文章正文版权归 Springer Nature 所有。数据集归其原始提供者所有,本处不进行再分发。 © 2026 Baheesa Fatima, Asim Dilawar Bakhshi & Abdul Ghafoor
标签:OpenCV, TensorFlow, 数字取证, 时间卷积网络, 自动化脚本, 视频伪造检测, 视频防篡改, 逆向工具, 集成学习