# FSVEaDS **Repository Path**: YOJOCO/FSVEaDS ## Basic Information - **Project Name**: FSVEaDS - **Description**: 背景减除算法研究 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-03-12 - **Last Updated**: 2025-06-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 基于背景减除的视频编解码优化 ## 项目简介 本项目研究了一种基于背景减除算法的高效视频编解码方案,旨在优化固定场景消费级监控的视频存储与传输。通过将静态背景与动态前景分离,本系统能够减少存储和带宽占用,同时保持高质量的视频回放。 ## 功能模块 ### 1. 预处理 - **视频帧提取** (`extract_frames.py`):从视频中分离帧图像。 - **静态背景计算** (`compute_background.py`):使用前 150 帧计算背景图。 - **Ground Truth 生成** (`generate_ground_truth.py`):解析 XML 数据集,生成真实掩码。 ### 2. 前景检测 - **单高斯背景建模** (`gaussian.py`) - **混合高斯背景建模 (MOG2)** (`mog2.py`) - **核密度估计 (KDE)** (`kde.py`) - **深度学习 (DeepLabV3)** (`deeplabv3.py`) ### 3. 评估 - **前景检测评估** (`evaluate_foreground_detection.py`):计算准确率 (Precision)、召回率 (Recall)、F1-score。 ### 4. 后处理 - **前景与背景合成** (`merge_foreground_background.py`) - **视频生成与压缩** (`generate_video.py`) ## 文件结构 ``` FSVEaDS/ │── data/ # 存放所有数据 │ ├── input_video/ # 原始视频 │ ├── extracted_frames/ # 提取的原始视频帧 │ ├── background/ # 计算出的静态背景图 │ ├── annotations/ # XML 标注文件 │ ├── ground_truth/ # 真实前景掩码 │ ├── processed_frames/ # 生成的前景二值掩码 │ ├── output_frames/ # 合成的前景+背景帧 │ ├── output_video/ # 生成的视频 │ │── scripts/ # 代码目录 │ ├── preprocessing/ # 预处理 │ ├── foreground_detection/ # 前景检测 │ ├── evaluation/ # 评估 │ ├── postprocessing/ # 后处理 │ │── results/ # 存放实验结果 │── requirements.txt # 依赖库列表 │── README.md # 项目说明文件 ``` ## 运行方式 ### 1. 安装依赖 ```bash pip install -r requirements.txt ``` ### 2. 运行各模块 #### **(1) 预处理** ```bash python scripts/preprocessing/extract_frames.py python scripts/preprocessing/compute_background.py python scripts/preprocessing/generate_ground_truth.py ``` #### **(2) 前景检测** ```bash python scripts/foreground_detection/gaussian.py python scripts/foreground_detection/mog2.py python scripts/foreground_detection/kde.py python scripts/foreground_detection/deeplabv3.py ``` #### **(3) 评估** ```bash python scripts/evaluation/evaluate_foreground_detection.py ``` #### **(4) 结果后处理** ```bash python scripts/postprocessing/merge_foreground_background.py python scripts/postprocessing/generate_video.py ``` ## 评估结果(DeepLabV3) - **准确率 (Precision):** 0.9049 - **召回率 (Recall):** 0.5766 - **F1 分数 (F1-score):** 0.6946 ## 贡献 如果你对本项目有优化建议,欢迎提交 PR 或 Issue!