Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created Dockerfile & Python Script to Run all Models for Images and Videos #5437

Open
michaelslice opened this issue Feb 20, 2025 · 0 comments
Labels
documentation Problems about existing documentation or comments

Comments

@michaelslice
Copy link

📚 Documentation Issue

I know... the documentation is hard to follow, and there are a million dependencies to get this project to work. Well no worries, because I have created a Dockerfile and a Python Script to run and process all your images/videos in a GPU accelerated environment!

The Dockerfile and Repo is available here michaelslice Github Link

I was able to do so with these commands below in a Dockerfile, and a Python Script available on my Github.

# Base image with CUDA 11.3.1 and cuDNN 8
FROM nvidia/cuda:11.3.1-cudnn8-runtime-ubuntu20.04

# Install system dependencies
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    git \
    python3.8 \
    python3.8-dev \
    python3.8-distutils \
    python3-pip \
    libgl1 \
    ffmpeg \
    wget \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    libqt5x11extras5 \
    g++ \ 
    gcc \ 
    cmake \
    libgtk2.0-dev \
    pkg-config \
    && rm -rf /var/lib/apt/lists/*

# Set Python 3.8 as the default Python version
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1

# Upgrade pip and install Python dependencies
RUN python3 -m pip install --upgrade pip && \
    pip3 install opencv-python-headless && \
    pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu113 && \
    python3 -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

# Create data directory
RUN mkdir -p data
COPY ./data data

# Download the model file and set permissions
RUN wget https://dl.fbaipublicfiles.com/detectron2/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl -O model_final_cafdb1.pkl && \
    chmod 644 model_final_cafdb1.pkl

# Copy the rest of the application code
COPY . .

# Set proper permissions for the data directory
RUN chmod -R 755 data

@michaelslice michaelslice added the documentation Problems about existing documentation or comments label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Problems about existing documentation or comments
Projects
None yet
Development

No branches or pull requests

1 participant