MogensR commited on
Commit
53f4a96
·
1 Parent(s): c2b4ae5
Files changed (6) hide show
  1. DEPLOYMENT.md +90 -0
  2. Dockerfile +60 -18
  3. build_and_deploy.sh +46 -0
  4. health_check.py +82 -0
  5. requirements-pinned.txt +51 -0
  6. requirements.txt +11 -10
DEPLOYMENT.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VideoBackgroundReplacer2 Deployment Guide
2
+
3
+ This guide provides instructions for deploying the VideoBackgroundReplacer2 application to Hugging Face Spaces with GPU acceleration.
4
+
5
+ ## Prerequisites
6
+
7
+ - Docker
8
+ - Git
9
+ - Python 3.8+
10
+ - NVIDIA Container Toolkit (for local GPU testing)
11
+ - Hugging Face account with access to GPU Spaces
12
+
13
+ ## Local Development
14
+
15
+ ### 1. Clone the repository
16
+ ```bash
17
+ git clone <repository-url>
18
+ cd VideoBackgroundReplacer2
19
+ ```
20
+
21
+ ### 2. Build the Docker image
22
+ ```bash
23
+ # Make the build script executable
24
+ chmod +x build_and_deploy.sh
25
+
26
+ # Build the image
27
+ ./build_and_deploy.sh
28
+ ```
29
+
30
+ ### 3. Run the container locally
31
+ ```bash
32
+ docker run --gpus all -p 7860:7860 -v $(pwd)/checkpoints:/home/user/app/checkpoints videobackgroundreplacer2:latest
33
+ ```
34
+
35
+ ## Hugging Face Spaces Deployment
36
+
37
+ ### 1. Create a new Space
38
+ - Go to [Hugging Face Spaces](https://huggingface.co/spaces)
39
+ - Click "Create new Space"
40
+ - Select "Docker" as the SDK
41
+ - Choose a name and set the space to private if needed
42
+ - Select GPU as the hardware
43
+
44
+ ### 2. Configure the Space
45
+ Add the following environment variables to your Space settings:
46
+ - `SAM2_DEVICE`: `cuda`
47
+ - `MATANY_DEVICE`: `cuda`
48
+ - `PYTORCH_CUDA_ALLOC_CONF`: `max_split_size_mb:256,garbage_collection_threshold:0.8`
49
+ - `TORCH_CUDA_ARCH_LIST`: `7.5 8.0 8.6+PTX`
50
+
51
+ ### 3. Deploy to Hugging Face
52
+ ```bash
53
+ # Set your Hugging Face token
54
+ export HF_TOKEN=your_hf_token
55
+ export HF_USERNAME=your_username
56
+
57
+ # Build and deploy
58
+ ./build_and_deploy.sh
59
+ ```
60
+
61
+ ## Health Check
62
+
63
+ You can verify the installation by running:
64
+ ```bash
65
+ docker run --rm videobackgroundreplacer2:latest python3 health_check.py
66
+ ```
67
+
68
+ ## Troubleshooting
69
+
70
+ ### Build Failures
71
+ - Ensure you have enough disk space (at least 10GB free)
72
+ - Check Docker logs for specific error messages
73
+ - Verify your internet connection is stable
74
+
75
+ ### Runtime Issues
76
+ - Check container logs: `docker logs <container_id>`
77
+ - Verify GPU is detected: `nvidia-smi` inside the container
78
+ - Check disk space: `df -h`
79
+
80
+ ## Performance Optimization
81
+
82
+ - For faster inference, use the `sam2_hiera_tiny` model
83
+ - Adjust batch size based on available GPU memory
84
+ - Enable gradient checkpointing for large models
85
+
86
+ ## Monitoring
87
+
88
+ - Use `nvidia-smi` to monitor GPU usage
89
+ - Check container logs for any warnings or errors
90
+ - Monitor memory usage with `htop` or similar tools
Dockerfile CHANGED
@@ -1,10 +1,23 @@
1
  # ===============================
2
  # BackgroundFX Pro — Dockerfile (CUDA 12.1.1 aligned)
 
3
  # ===============================
4
 
5
  # ===== CHAPTER 1: Base image & user =====
6
  FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
7
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ARG SAM2_SHA=__PIN_ME__
9
  ARG SAM2_MODEL_ID=facebook/sam2
10
  ARG SAM2_VARIANT=sam2_hiera_large
@@ -25,29 +38,32 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
25
  git ffmpeg python3 python3-pip python3-venv \
26
  wget curl ca-certificates \
27
  libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender-dev libgomp1 \
28
- && rm -rf /var/lib/apt/lists/*
 
 
29
 
30
- # ===== CHAPTER 3: Python & Torch (match CUDA 12.1.1) =====
31
  RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
32
- # Torch cu121 wheels (MATCH base image CUDA 12.1.1)
 
33
  RUN python3 -m pip install --no-cache-dir \
34
- --extra-index-url https://download.pytorch.org/whl/cu121 \
35
- torch==2.3.1+cu121 torchvision==0.18.1+cu121 torchaudio==2.3.1+cu121 && \
36
- python3 - <<'PY'
37
- import torch
38
- print("VERIFY Torch:", torch.__version__, "CUDA:", torch.version.cuda)
39
- assert torch.__version__.startswith("2.3.1") and torch.version.cuda.startswith("12.1")
40
- PY
41
-
42
- # ===== CHAPTER 4: App deps + MatAnyone =====
43
- COPY --chown=user requirements.txt ./requirements.txt
44
- # (requirements.txt intentionally has NO torch/torchvision/torchaudio)
45
- RUN python3 -m pip install --no-cache-dir -r requirements.txt
46
 
47
  # Install MatAnyone from GitHub (following official documentation)
48
  RUN echo "Installing MatAnyone from GitHub (main branch)..." && \
49
  python3 -m pip install --no-cache-dir -v \
50
- git+https://github.com/pq-yang/MatAnyone@main && \
51
  echo "MatAnyone installation complete" && \
52
  python3 -c "import matanyone; print('MatAnyone imported successfully')"
53
 
@@ -55,7 +71,19 @@ RUN echo "Installing MatAnyone from GitHub (main branch)..." && \
55
  USER user
56
  COPY --chown=user . /home/user/app
57
 
58
- # ===== CHAPTER 6: Third-party SAM2 (editable) =====
 
 
 
 
 
 
 
 
 
 
 
 
59
  USER root
60
  RUN rm -rf third_party/sam2 && \
61
  git clone --depth=1 https://github.com/facebookresearch/segment-anything-2.git third_party/sam2 && \
@@ -98,6 +126,20 @@ ENV PYTHONUNBUFFERED=1 \
98
  ENABLE_MATANY=1 \
99
  SAM2_DEVICE=cuda \
100
  MATANY_DEVICE=cuda \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  MATANY_FORCE_VIDEO=0 \
102
  MATANY_PREFER_VIDEO=0 \
103
  MATANY_FORCE_STEP=0 \
@@ -107,5 +149,5 @@ USER user
107
  EXPOSE 7860
108
 
109
  # ===== CHAPTER 8: Healthcheck & CMD =====
110
- HEALTHCHECK --interval=30s --timeout=5s --retries=5 CMD wget -qO- "http://127.0.0.1:${PORT:-7860}/" || exit 1
111
  CMD ["python3","-u","app.py"]
 
1
  # ===============================
2
  # BackgroundFX Pro — Dockerfile (CUDA 12.1.1 aligned)
3
+ # Pinned to PyTorch 2.3.1 + CUDA 12.1
4
  # ===============================
5
 
6
  # ===== CHAPTER 1: Base image & user =====
7
  FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
8
 
9
+ # Environment variables
10
+ ENV DEBIAN_FRONTEND=noninteractive \
11
+ PYTHONUNBUFFERED=1 \
12
+ PYTHONDONTWRITEBYTECODE=1 \
13
+ PIP_NO_CACHE_DIR=1 \
14
+ PIP_DISABLE_PIP_VERSION_CHECK=1 \
15
+ PIP_DEFAULT_TIMEOUT=100 \
16
+ TORCH_CUDA_ARCH_LIST="7.5 8.0 8.6+PTX" \
17
+ TORCH_NVCC_FLAGS="-Xfatbin -compress-all" \
18
+ FORCE_CUDA="1" \
19
+ CUDA_VISIBLE_DEVICES="0"
20
+
21
  ARG SAM2_SHA=__PIN_ME__
22
  ARG SAM2_MODEL_ID=facebook/sam2
23
  ARG SAM2_VARIANT=sam2_hiera_large
 
38
  git ffmpeg python3 python3-pip python3-venv \
39
  wget curl ca-certificates \
40
  libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender-dev libgomp1 \
41
+ libgl1 \
42
+ && rm -rf /var/lib/apt/lists/* \
43
+ && apt-get clean
44
 
45
+ # ===== CHAPTER 3: Python & Core Dependencies =====
46
  RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
47
+
48
+ # Install PyTorch with CUDA 12.1
49
  RUN python3 -m pip install --no-cache-dir \
50
+ --extra-index-url https://download.pytorch.org/whl/cu121 \
51
+ torch==2.3.1+cu121 \
52
+ torchvision==0.18.1+cu121 \
53
+ torchaudio==2.3.1+cu121 \
54
+ && python3 -c "import torch; print(f'PyTorch version: {torch.__version__}')\
55
+ print(f'CUDA available: {torch.cuda.is_available()}')\
56
+ print(f'CUDA version: {torch.version.cuda if torch.cuda.is_available() else "N/A"}')\
57
+ print(f'cuDNN version: {torch.backends.cudnn.version() if torch.cuda.is_available() else "N/A"}')"
58
+
59
+ # ===== CHAPTER 4: Install Pinned Dependencies =====
60
+ COPY --chown=user requirements-pinned.txt ./requirements-pinned.txt
61
+ RUN python3 -m pip install --no-cache-dir -r requirements-pinned.txt
62
 
63
  # Install MatAnyone from GitHub (following official documentation)
64
  RUN echo "Installing MatAnyone from GitHub (main branch)..." && \
65
  python3 -m pip install --no-cache-dir -v \
66
+ git+https://github.com/pq-yang/MatAnyone@main#egg=matanyone && \
67
  echo "MatAnyone installation complete" && \
68
  python3 -c "import matanyone; print('MatAnyone imported successfully')"
69
 
 
71
  USER user
72
  COPY --chown=user . /home/user/app
73
 
74
+ # ===== CHAPTER 6: Health check and final cleanup =====
75
+ # Copy and make health check script executable
76
+ COPY --chown=user health_check.py /home/user/app/
77
+ RUN chmod +x /home/user/app/health_check.py
78
+
79
+ # Run health check during build
80
+ RUN python3 /home/user/app/health_check.py
81
+
82
+ # Cleanup
83
+ RUN apt-get clean && \
84
+ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache /home/user/.cache/pip
85
+
86
+ # ===== CHAPTER 7: Third-party — SAM2 (editable) =====
87
  USER root
88
  RUN rm -rf third_party/sam2 && \
89
  git clone --depth=1 https://github.com/facebookresearch/segment-anything-2.git third_party/sam2 && \
 
126
  ENABLE_MATANY=1 \
127
  SAM2_DEVICE=cuda \
128
  MATANY_DEVICE=cuda \
129
+ # Disable unnecessary backends to reduce memory usage \
130
+ KMP_DETERMINISTIC_REDUCTION=1 \
131
+ KMP_INIT_AT_FORK=FALSE \
132
+ # Optimize PyTorch for inference \
133
+ TORCH_COMPILE_DEBUG=0 \
134
+ TORCHINDUCTOR_MAX_AUTOTUNE=1 \
135
+ # Disable debug logs \
136
+ TF_CPP_MIN_LOG_LEVEL=2 \
137
+ # Optimize OpenCV \
138
+ OPENCV_OPENCL_RUNTIME= \
139
+ OPENCV_OPENCL_DEVICE=:GPU: \
140
+ # Optimize NumPy \
141
+ NPY_NUM_BUFSIZE=8192 \
142
+ NPY_NUM_THREADS=2 \
143
  MATANY_FORCE_VIDEO=0 \
144
  MATANY_PREFER_VIDEO=0 \
145
  MATANY_FORCE_STEP=0 \
 
149
  EXPOSE 7860
150
 
151
  # ===== CHAPTER 8: Healthcheck & CMD =====
152
+ HEALTHCHECK --interval=30s --timeout=5s --retries=5 CMD python3 /home/user/app/health_check.py && wget -qO- "http://127.0.0.1:${PORT:-7860}/" || exit 1
153
  CMD ["python3","-u","app.py"]
build_and_deploy.sh ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Configuration
5
+ IMAGE_NAME="videobackgroundreplacer2"
6
+ TAG="latest"
7
+ REPO="huggingface/space" # Update with your HF space repo
8
+
9
+ # Colors for output
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ NC='\033[0m' # No Color
13
+
14
+ echo -e "${YELLOW}=== Building VideoBackgroundReplacer2 Docker Image ===${NC}"
15
+
16
+ # Build the Docker image
17
+ echo -e "${GREEN}Building Docker image...${NC}"
18
+ docker build -t "${IMAGE_NAME}:${TAG}" .
19
+
20
+ # Verify the image was built
21
+ if [ $? -ne 0 ]; then
22
+ echo -e "${YELLOW}Docker build failed. Please check the build logs.${NC}"
23
+ exit 1
24
+ fi
25
+
26
+ echo -e "${GREEN}Docker image built successfully!${NC}"
27
+
28
+ # Push to Hugging Face Space (if configured)
29
+ if [ -n "${HF_TOKEN}" ] && [ -n "${REPO}" ]; then
30
+ echo -e "${GREEN}Logging into Hugging Face Hub...${NC}"
31
+ echo "${HF_TOKEN}" | docker login -u "${HF_USERNAME:-user}" --password-stdin "registry.hf.space"
32
+
33
+ echo -e "${GREEN}Tagging and pushing image to Hugging Face Space...${NC}"
34
+ docker tag "${IMAGE_NAME}:${TAG}" "registry.hf.space/${REPO}/app:${TAG}"
35
+ docker push "registry.hf.space/${REPO}/app:${TAG}"
36
+
37
+ echo -e "${GREEN}Image pushed to Hugging Face Space!${NC}"
38
+ else
39
+ echo -e "${YELLOW}HF_TOKEN or REPO not set. Skipping push to Hugging Face Space.${NC}"
40
+ echo "To push to Hugging Face Space, set the following environment variables:"
41
+ echo " export HF_TOKEN=your_hf_token"
42
+ echo " export HF_USERNAME=your_hf_username"
43
+ echo " # Then run this script again"
44
+ fi
45
+
46
+ echo -e "${GREEN}=== Build and Deployment Complete ===${NC}"
health_check.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Health check script for VideoBackgroundReplacer2
4
+ Verifies all dependencies, CUDA, and model loading
5
+ """
6
+ import sys
7
+ import torch
8
+ import importlib.metadata
9
+ import subprocess
10
+ import platform
11
+ import json
12
+ from pathlib import Path
13
+
14
+ def print_header(title):
15
+ print(f"\n{'='*80}\n{title}\n{'='*80}")
16
+
17
+ def check_python():
18
+ print_header("PYTHON ENVIRONMENT")
19
+ print(f"Python: {sys.version}")
20
+ print(f"Platform: {platform.platform()}")
21
+ print(f"Working Directory: {Path.cwd()}")
22
+
23
+ def check_cuda():
24
+ print_header("CUDA & GPU STATUS")
25
+ print(f"PyTorch version: {torch.__version__}")
26
+ print(f"CUDA available: {torch.cuda.is_available()}")
27
+
28
+ if torch.cuda.is_available():
29
+ print(f"CUDA version: {torch.version.cuda}")
30
+ print(f"cuDNN version: {torch.backends.cudnn.version() if hasattr(torch.backends.cudnn, 'version') else 'N/A'}")
31
+ print(f"Number of GPUs: {torch.cuda.device_count()}")
32
+
33
+ for i in range(torch.cuda.device_count()):
34
+ print(f"\nGPU {i}:")
35
+ print(f" Name: {torch.cuda.get_device_name(i)}")
36
+ print(f" Memory: {torch.cuda.get_device_properties(i).total_memory/1024**3:.2f} GB")
37
+ else:
38
+ print("WARNING: CUDA is not available. Running in CPU mode.")
39
+
40
+ def check_dependencies():
41
+ print_header("INSTALLED PACKAGES")
42
+ packages = [
43
+ 'torch', 'torchvision', 'torchaudio',
44
+ 'numpy', 'opencv-python', 'gradio',
45
+ 'mediapipe', 'huggingface-hub', 'matanyone',
46
+ 'segment-anything-2'
47
+ ]
48
+
49
+ for pkg in packages:
50
+ try:
51
+ version = importlib.metadata.version(pkg)
52
+ print(f"{pkg}: {version}")
53
+ except importlib.metadata.PackageNotFoundError:
54
+ print(f"{pkg}: NOT INSTALLED")
55
+
56
+ def check_models():
57
+ print_header("MODEL CHECK")
58
+ # Add model loading checks here
59
+ pass
60
+
61
+ def check_environment():
62
+ print_header("ENVIRONMENT VARIABLES")
63
+ env_vars = [
64
+ 'CUDA_VISIBLE_DEVICES', 'TORCH_CUDA_ARCH_LIST',
65
+ 'PYTORCH_CUDA_ALLOC_CONF', 'PYTHONPATH',
66
+ 'SAM2_DEVICE', 'MATANY_DEVICE'
67
+ ]
68
+
69
+ for var in env_vars:
70
+ print(f"{var}: {os.environ.get(var, 'Not set')}")
71
+
72
+ if __name__ == "__main__":
73
+ try:
74
+ check_python()
75
+ check_cuda()
76
+ check_dependencies()
77
+ check_environment()
78
+ check_models()
79
+ print("\n✅ Health check completed successfully!")
80
+ except Exception as e:
81
+ print(f"\n❌ Health check failed: {str(e)}", file=sys.stderr)
82
+ sys.exit(1)
requirements-pinned.txt ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pinned requirements for Hugging Face Space deployment
2
+ # Generated 2025-09-17
3
+
4
+ # Core
5
+ numpy==1.24.4
6
+ Pillow==10.4.0
7
+ protobuf==4.25.3
8
+
9
+ # Image/Video Processing
10
+ opencv-python-headless==4.8.1.78
11
+ imageio==2.25.0
12
+ imageio-ffmpeg==0.4.9
13
+ moviepy==1.0.3
14
+ decord==0.6.0
15
+ scikit-image==0.20.0
16
+
17
+ # MediaPipe
18
+ mediapipe==0.10.21
19
+
20
+ # SAM2 Dependencies
21
+ --extra-index-url https://download.pytorch.org/whl/cu121
22
+ git+https://github.com/facebookresearch/segment-anything-2@main#egg=segment-anything-2
23
+ hydra-core==1.3.2
24
+ omegaconf==2.3.0
25
+ einops==0.8.1
26
+ timm==1.0.19
27
+ pyyaml==6.0.2
28
+ matplotlib==3.10.6
29
+
30
+ # MatAnyone Dependencies
31
+ git+https://github.com/pq-yang/MatAnyone@main#egg=matanyone
32
+ kornia==0.7.4
33
+ tqdm==4.67.1
34
+
35
+ # UI and API
36
+ gradio==5.46.0
37
+
38
+ # Helpers and Utilities
39
+ huggingface-hub==0.35.0
40
+ ffmpeg-python==0.2.0
41
+ psutil==6.1.1
42
+ requests==2.32.5
43
+ scikit-learn==1.7.2
44
+
45
+ # Additional Dependencies
46
+ gputil==1.4.0
47
+ nvidia-ml-py3==7.352.0
48
+ loguru==0.7.3
49
+ python-multipart==0.0.20
50
+ uvicorn==0.35.0
51
+ fastapi==0.116.2
requirements.txt CHANGED
@@ -1,7 +1,8 @@
1
- # ===== Core Dependencies with CUDA 12.1 =====
2
- torch==2.3.1+cu121
3
- torchvision==0.18.1+cu121
4
- torchaudio==2.3.1+cu121
 
5
 
6
  # ===== Base Dependencies =====
7
  numpy>=1.24.0,<2.0.0
@@ -9,7 +10,7 @@ Pillow>=10.0.0,<11.0.0
9
  protobuf>=4.25.0,<5.0.0
10
 
11
  # ===== Image/Video Processing =====
12
- opencv-python-headless>=4.8.0,<5.0.0
13
  imageio>=2.25.0,<3.0.0
14
  imageio-ffmpeg>=0.4.7,<0.6.0
15
  moviepy>=1.0.3,<2.0.0
@@ -17,10 +18,10 @@ decord>=0.6.0,<0.7.0
17
  scikit-image>=0.19.3,<0.21.0
18
 
19
  # ===== MediaPipe =====
20
- mediapipe>=0.10.0,<0.11.0
21
 
22
  # ===== SAM2 Dependencies =====
23
- git+https://github.com/facebookresearch/segment-anything-2@main
24
  hydra-core>=1.3.2,<2.0.0
25
  omegaconf>=2.3.0,<3.0.0
26
  einops>=0.8.0,<0.9.0
@@ -29,15 +30,15 @@ pyyaml>=6.0.2,<7.0.0
29
  matplotlib>=3.9.2,<4.0.0
30
 
31
  # ===== MatAnyone Dependencies =====
32
- git+https://github.com/pq-yang/MatAnyone@main
33
  kornia>=0.7.3,<0.8.0
34
  tqdm>=4.66.5,<5.0.0
35
 
36
  # ===== UI and API =====
37
- gradio>=5.42.0,<6.0.0
38
 
39
  # ===== Helpers and Utilities =====
40
- huggingface-hub>=0.33.5,<1.0.0
41
  ffmpeg-python>=0.2.0,<1.0.0
42
  psutil>=6.0.0,<7.0.0
43
  requests>=2.32.3,<3.0.0
 
1
+ # ===== Core Dependencies =====
2
+ # PyTorch is installed in Dockerfile with CUDA 12.1
3
+ # torch==2.3.1+cu121
4
+ # torchvision==0.18.1+cu121
5
+ # torchaudio==2.3.1+cu121
6
 
7
  # ===== Base Dependencies =====
8
  numpy>=1.24.0,<2.0.0
 
10
  protobuf>=4.25.0,<5.0.0
11
 
12
  # ===== Image/Video Processing =====
13
+ opencv-python-headless==4.8.1.78
14
  imageio>=2.25.0,<3.0.0
15
  imageio-ffmpeg>=0.4.7,<0.6.0
16
  moviepy>=1.0.3,<2.0.0
 
18
  scikit-image>=0.19.3,<0.21.0
19
 
20
  # ===== MediaPipe =====
21
+ mediapipe==0.10.21
22
 
23
  # ===== SAM2 Dependencies =====
24
+ git+https://github.com/facebookresearch/segment-anything-2@main#egg=segment-anything-2
25
  hydra-core>=1.3.2,<2.0.0
26
  omegaconf>=2.3.0,<3.0.0
27
  einops>=0.8.0,<0.9.0
 
30
  matplotlib>=3.9.2,<4.0.0
31
 
32
  # ===== MatAnyone Dependencies =====
33
+ git+https://github.com/pq-yang/MatAnyone@main#egg=matanyone
34
  kornia>=0.7.3,<0.8.0
35
  tqdm>=4.66.5,<5.0.0
36
 
37
  # ===== UI and API =====
38
+ gradio==5.46.0
39
 
40
  # ===== Helpers and Utilities =====
41
+ huggingface-hub==0.35.0
42
  ffmpeg-python>=0.2.0,<1.0.0
43
  psutil>=6.0.0,<7.0.0
44
  requests>=2.32.3,<3.0.0