Skip to content

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

Open
@michaelslice

Description

@michaelslice

📚 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationProblems about existing documentation or comments

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions