From 7a5384ad95f08102d522bc9827b2f461494a7ac1 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 6 May 2025 22:08:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 169 +++++++++++++++++++++------------------------ README_en.md | 188 +++++++++++++++++++++++++++------------------------ 2 files changed, 175 insertions(+), 182 deletions(-) diff --git a/README.md b/README.md index da759e5..4886705 100755 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## 项目简介 ![License](https://img.shields.io/badge/License-Apache%202-red.svg) -![python version](https://img.shields.io/badge/Python-3.8+-blue.svg) +![python version](https://img.shields.io/badge/Python-3.11+-blue.svg) ![support os](https://img.shields.io/badge/OS-Windows/macOS/Linux-green.svg) Video-subtitle-remover (VSR) 是一款基于AI技术,将视频中的硬字幕去除的软件。 @@ -29,7 +29,15 @@ Windows GPU版本v1.1.0(GPU): - Google Drive: vsr_windows_gpu_v1.1.0.zip -> 仅供具有Nvidia显卡的用户使用(AMD的显卡不行) +**预构建包对比说明**: +| 预构建包名 | Python | Paddle | Torch | 环境 | 支持的计算能力范围| +|---------------|------------|--------------|--------------|-----------------------------|----------| +| `vsr-windows-directml.7z` | 3.12 | 3.0.0 | 2.4.1 | Windows 非Nvidia显卡 | 通用 | +| `vsr-windows-nvidia-cuda-11.8.7z` | 3.12 | 3.0.0 | 2.7.0 | CUDA 11.8 | 3.5 – 8.9 | +| `vsr-windows-nvidia-cuda-12.6.7z` | 3.12 | 3.0.0 | 2.7.0 | CUDA 12.6 | 5.0 – 8.9 | +| `vsr-windows-nvidia-cuda-12.8.7z` | 3.12 | 3.0.0 | 2.7.0 | CUDA 12.8 | 5.0 – 9.0+ | + +> NVIDIA官方提供了各GPU型号的计算能力列表,您可以参考链接: [CUDA GPUs](https://developer.nvidia.com/cuda-gpus) 查看你的GPU适合哪个CUDA版本 **Docker版本:** ```shell @@ -62,114 +70,98 @@ Windows GPU版本v1.1.0(GPU): ## 源码使用说明 -> **无Nvidia显卡请勿使用本项目**,最低配置: -> -> **GPU**:GTX 1060或以上显卡 -> -> CPU: 支持AVX指令集 -#### 1. 下载安装Miniconda +#### 1. 安装 Python -- Windows: Miniconda3-py38_4.11.0-Windows-x86_64.exe +请确保您已经安装了 Python 3.12+。 -- Linux: Miniconda3-py38_4.11.0-Linux-x86_64.sh +- Windows 用户可以前往 [Python 官网](https://www.python.org/downloads/windows/) 下载并安装 Python。 +- MacOS 用户可以使用 Homebrew 安装: + ```shell + brew install python@3.12 + ``` +- Linux 用户可以使用包管理器安装,例如 Ubuntu/Debian: + ```shell + sudo apt update && sudo apt install python3.12 python3.12-venv python3.12-dev + ``` -#### 2. 创建并激活虚机环境 +#### 2. 安装依赖文件 -(1)切换到源码所在目录: +请使用虚拟环境来管理项目依赖,避免与系统环境冲突。 + +(1)创建虚拟环境并激活 +```shell +python -m venv videoEnv +``` + +- Windows: +```shell +videoEnv\\Scripts\\activate +``` +- MacOS/Linux: +```shell +source videoEnv/bin/activate +``` + +#### 3. 创建并激活项目目录 + +切换到源码所在目录: ```shell cd <源码所在目录> ``` -> 例如:如果你的源代码放在D盘的tools文件下,并且源代码的文件夹名为video-subtitle-remover,就输入 ```cd D:/tools/video-subtitle-remover-main``` +> 例如:如果您的源代码放在 D 盘的 tools 文件夹下,并且源代码的文件夹名为 video-subtitle-remover,则输入: +> ```shell +> cd D:/tools/video-subtitle-remover-main +> ``` -(2)创建激活conda环境 -```shell -conda create -n videoEnv python=3.8 -``` +#### 4. 安装合适的运行环境 -```shell -conda activate videoEnv -``` +本项目支持 CUDA(NVIDIA显卡加速)和 DirectML(AMD、Intel等GPU/APU加速)两种运行模式。 -#### 3. 安装依赖文件 +##### (1) CUDA(NVIDIA 显卡用户) -请确保你已经安装 python 3.8+,使用conda创建项目虚拟环境并激活环境 (建议创建虚拟环境运行,以免后续出现问题) +> 请确保您的 NVIDIA 显卡驱动支持所选 CUDA 版本。 -- 安装CUDA和cuDNN +- 推荐 CUDA 11.8,对应 cuDNN 8.6.0。 -
- Linux用户 -
(1) 下载CUDA 11.7
-
wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
-
(2) 安装CUDA 11.7
-
sudo sh cuda_11.7.0_515.43.04_linux.run
-

1. 输入accept

- -

2. 选中CUDA Toolkit 11.7(如果你没有安装nvidia驱动则选中Driver,如果你已经安装了nvidia驱动请不要选中driver),之后选中install,回车

- -

3. 添加环境变量

-

在 ~/.bashrc 加入以下内容

-
# CUDA
-  export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}}
-  export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
-

使其生效

-
source ~/.bashrc
-
(3) 下载cuDNN 8.4.1
-

国内:cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz 提取码:57mg

-

国外:cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz

-
(4) 安装cuDNN 8.4.1
-
 tar -xf cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz
-   mv cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive cuda
-   sudo cp ./cuda/include/* /usr/local/cuda-11.7/include/
-   sudo cp ./cuda/lib/* /usr/local/cuda-11.7/lib64/
-   sudo chmod a+r /usr/local/cuda-11.7/lib64/*
-   sudo chmod a+r /usr/local/cuda-11.7/include/*
-
+- 安装 CUDA: + - Windows:[CUDA 11.8 下载](https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_522.06_windows.exe) + - Linux: + ```shell + wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run + sudo sh cuda_11.8.0_520.61.05_linux.run + ``` + - MacOS 不支持 CUDA。 -
- Windows用户 -
(1) 下载CUDA 11.7
- cuda_11.7.0_516.01_windows.exe -
(2) 安装CUDA 11.7
-
(3) 下载cuDNN v8.4.0 (April 1st, 2022), for CUDA 11.x
-

cudnn-windows-x86_64-8.4.0.27_cuda11.6-archive.zip

-
(4) 安装cuDNN 8.4.0
-

- 将cuDNN解压后的cuda文件夹中的bin, include, lib目录下的文件复制到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\对应目录下 -

-
+- 安装 cuDNN(CUDA 11.8 对应 cuDNN 8.6.0): + - [Windows cuDNN 8.6.0 下载](https://developer.download.nvidia.cn/compute/redist/cudnn/v8.6.0/local_installers/11.8/cudnn-windows-x86_64-8.6.0.163_cuda11-archive.zip) + - [Linux cuDNN 8.6.0 下载](https://developer.download.nvidia.cn/compute/redist/cudnn/v8.6.0/local_installers/11.8/cudnn-linux-x86_64-8.6.0.163_cuda11-archive.tar.xz) + - 安装方法请参考 NVIDIA 官方文档。 - -- 安装GPU版本Paddlepaddle: - - - windows: - - ```shell - python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html - ``` - - - Linux: - - ```shell - python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html - ``` - -- 安装GPU版本Pytorch: - +- 安装 PaddlePaddle GPU 版本(CUDA 11.8): ```shell - conda install pytorch==2.0.1 torchvision==0.15.2 pytorch-cuda=11.8 -c pytorch -c nvidia + pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/ ``` - 或者使用 +- 安装 Torch GPU 版本(CUDA 11.8): ```shell - pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu118 + pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu118 ``` -- 安装其他依赖: - +- 安装其他依赖 ```shell pip install -r requirements.txt ``` +##### (2) DirectML(AMD、Intel等GPU/APU加速卡用户) + +- 适用于 Windows 设备的 AMD/NVIDIA/Intel GPU。 +- 安装 ONNX Runtime DirectML 版本: + ```shell + pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/ + pip install -r requirements.txt + pip install torch_directml==0.2.5.dev240914 + ``` + #### 4. 运行程序 @@ -232,13 +224,6 @@ LAMA_SUPER_FAST = False # 保证效果 解决方案:升级7-zip解压程序到最新版本 -5. 4090使用cuda 11.7跑不起来 - -解决方案:改用cuda 11.8 - -```shell -pip install torch==2.1.0 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu118 -``` ## 赞助 diff --git a/README_en.md b/README_en.md index 6a59e3a..1bbd841 100755 --- a/README_en.md +++ b/README_en.md @@ -3,7 +3,7 @@ ## Project Introduction ![License](https://img.shields.io/badge/License-Apache%202-red.svg) -![python version](https://img.shields.io/badge/Python-3.8+-blue.svg) +![python version](https://img.shields.io/badge/Python-3.11+-blue.svg) ![support os](https://img.shields.io/badge/OS-Windows/macOS/Linux-green.svg) Video-subtitle-remover (VSR) is an AI-based software that removes hardcoded subtitles from videos. It mainly implements the following functionalities: @@ -26,7 +26,36 @@ Windows GPU Version v1.1.0 (GPU): - Google Drive: vsr_windows_gpu_v1.1.0.zip -> For use only by users with Nvidia graphics cards (AMD graphics cards are not supported). + +**Pre-built Package Comparison**: + +| Pre-built Package Name | Python | Paddle | Torch | Environment | Supported Compute Capability Range | +|----------------------------------|--------|--------|--------|-----------------------------------|------------------------------------| +| `vse-windows-directml.7z` | 3.12 | 3.0.0 | 2.4.1 | Windows without Nvidia GPU | Universal | +| `vse-windows-nvidia-cuda-11.8.7z`| 3.12 | 3.0.0 | 2.7.0 | CUDA 11.8 | 3.5 – 8.9 | +| `vse-windows-nvidia-cuda-12.6.7z`| 3.12 | 3.0.0 | 2.7.0 | CUDA 12.6 | 5.0 – 8.9 | +| `vse-windows-nvidia-cuda-12.8.7z`| 3.12 | 3.0.0 | 2.7.0 | CUDA 12.8 | 5.0 – 9.0+ | + +> NVIDIA provides a list of supported compute capabilities for each GPU model. You can refer to the following link: [CUDA GPUs](https://developer.nvidia.com/cuda-gpus) to check which CUDA version is compatible with your GPU. + +**Docker Versions:** +```shell + # Nvidia 10, 20, 30 Series Graphics Cards + docker run -it --name vsr --gpus all eritpchy/video-subtitle-remover:1.1.1-cuda11.8 + + # Nvidia 40 Series Graphics Cards + docker run -it --name vsr --gpus all eritpchy/video-subtitle-remover:1.1.1-cuda12.6 + + # Nvidia 50 Series Graphics Cards + docker run -it --name vsr --gpus all eritpchy/video-subtitle-remover:1.1.1-cuda12.8 + + # AMD / Intel Dedicated or Integrated Graphics + docker run -it --name vsr --gpus all eritpchy/video-subtitle-remover:1.1.1-directml + + # Demo video, input + /vsr/test/test.mp4 + docker cp vsr:/vsr/test/test_no_sub.mp4 ./ +``` ## Demonstration @@ -40,117 +69,98 @@ Windows GPU Version v1.1.0 (GPU): ## Source Code Usage Instructions -> **Do not use this project without an Nvidia graphics card**. The minimum requirements are: -> -> **GPU**: GTX 1060 or higher graphics card -> -> CPU: Supports AVX instruction set +#### 1. Install Python -#### 1. Download and install Miniconda +Please ensure that you have installed Python 3.12+. -- Windows: Miniconda3-py38_4.11.0-Windows-x86_64.exe +- Windows users can go to the [Python official website](https://www.python.org/downloads/windows/) to download and install Python. +- MacOS users can install using Homebrew: + ```shell + brew install python@3.12 + ``` +- Linux users can install via the package manager, such as on Ubuntu/Debian: + ```shell + sudo apt update && sudo apt install python3.12 python3.12-venv python3.12-dev + ``` -- Linux: Miniconda3-py38_4.11.0-Linux-x86_64.sh +#### 2. Install Dependencies -#### 2. Create and activate a virtual environment +It is recommended to use a virtual environment to manage project dependencies to avoid conflicts with the system environment. -(1) Switch to the source code directory: +(1) Create and activate the virtual environment: +```shell +python -m venv videoEnv +``` +- Windows: +```shell +videoEnv\\Scripts\\activate +``` +- MacOS/Linux: +```shell +source videoEnv/bin/activate +``` + +#### 3. Create and Activate Project Directory + +Change to the directory where your source code is located: ```shell cd ``` +> For example, if your source code is in the `tools` folder on the D drive and the folder name is `video-subtitle-remover`, use: +> ```shell +> cd D:/tools/video-subtitle-remover-main +> ``` -> For example, if your source code is in the `tools` folder on drive D, and the source code folder name is `video-subtitle-remover`, enter `cd D:/tools/video-subtitle-remover-main`. +#### 4. Install the Appropriate Runtime Environment -(2) Create and activate the conda environment: +This project supports two runtime modes: CUDA (NVIDIA GPU acceleration) and DirectML (AMD, Intel, and other GPUs/APUs). -```shell -conda create -n videoEnv python=3.8 -``` +##### (1) CUDA (For NVIDIA GPU users) -```shell -conda activate videoEnv -``` +> Make sure your NVIDIA GPU driver supports the selected CUDA version. -#### 3. Install dependencies - -Please make sure you have already installed Python 3.8+, use conda to create a project virtual environment and activate the environment (it is recommended to create a virtual environment to run to avoid subsequent problems). - - - Install **CUDA** and **cuDNN** - -
- Linux -
(1) Download CUDA 11.7
-
wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
-
(2) Install CUDA 11.7
-
sudo sh cuda_11.7.0_515.43.04_linux.run
-

1. Input accept

- -

2. make sure CUDA Toolkit 11.7 is chosen (If you have already installed driver, do not select Driver)

- -

3. Add environment variables

-

add the following content in ~/.bashrc

-
# CUDA
-      export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}}
-      export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
-

Make sure it works

-
source ~/.bashrc
-
(3) Download cuDNN 8.4.1
-

cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz

-
(4) Install cuDNN 8.4.1
-
 tar -xf cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz
-     mv cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive cuda
-     sudo cp ./cuda/include/* /usr/local/cuda-11.7/include/
-     sudo cp ./cuda/lib/* /usr/local/cuda-11.7/lib64/
-     sudo chmod a+r /usr/local/cuda-11.7/lib64/*
-     sudo chmod a+r /usr/local/cuda-11.7/include/*
-
- -
- Windows -
(1) Download CUDA 11.7
- cuda_11.7.0_516.01_windows.exe -
(2) Install CUDA 11.7
-
(3) Download cuDNN 8.4.0
-

cudnn-windows-x86_64-8.4.0.27_cuda11.6-archive.zip

-
(4) Install cuDNN 8.4.0
-

- unzip "cudnn-windows-x86_64-8.4.0.27_cuda11.6-archive.zip", then move all files in "bin, include, lib" in cuda - directory to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\ -

-
- - -- Install GPU version of Paddlepaddle: - - windows: - - ```shell - python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html - ``` +- Recommended CUDA 11.8, corresponding to cuDNN 8.6.0. +- Install CUDA: + - Windows: [Download CUDA 11.8](https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_522.06_windows.exe) - Linux: + ```shell + wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run + sudo sh cuda_11.8.0_520.61.05_linux.run + ``` + - CUDA is not supported on MacOS. - ```shell - python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html - ``` +- Install cuDNN (CUDA 11.8 corresponds to cuDNN 8.6.0): + - [Windows cuDNN 8.6.0 Download](https://developer.download.nvidia.cn/compute/redist/cudnn/v8.6.0/local_installers/11.8/cudnn-windows-x86_64-8.6.0.163_cuda11-archive.zip) + - [Linux cuDNN 8.6.0 Download](https://developer.download.nvidia.cn/compute/redist/cudnn/v8.6.0/local_installers/11.8/cudnn-linux-x86_64-8.6.0.163_cuda11-archive.tar.xz) + - Follow the installation guide in the NVIDIA official documentation. -- Install GPU version of Pytorch: - - ```shell - conda install pytorch==2.1.0 torchvision==0.16.0 pytorch-cuda=11.8 -c pytorch -c nvidia +- Install PaddlePaddle GPU version (CUDA 11.8): + ```shell + pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/ ``` - or use - - ```shell - pip install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cu118 + +- Install Torch GPU version (CUDA 11.8): + ```shell + pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu118 ``` - Install other dependencies: - ```shell pip install -r requirements.txt ``` +##### (2) DirectML (For AMD, Intel, and other GPU/APU users) + +- Suitable for Windows devices with AMD/NVIDIA/Intel GPUs. +- Install ONNX Runtime DirectML version: + ```shell + pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/ + pip install -r requirements.txt + pip install -r requirements_directml.txt + ``` + #### 4. Run the program @@ -215,6 +225,4 @@ Solution: https://zhuanlan.zhihu.com/p/260034241 Solution: Upgrade the 7-zip extraction program to the latest version. -```shell -pip install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cu118 -``` +