pull/381/merge
Alexey Yurasov 2025-02-02 15:44:10 +04:00 committed by GitHub
commit be2a24b659
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 41 additions and 24 deletions

View File

@ -1,35 +1,43 @@
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
ARG DEBIAN_FRONTEND=noninteractive
FROM nvidia/cuda:11.3.1-devel-ubuntu20.04
ENV CUDA_HOME=/usr/local/cuda \
TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6+PTX" \
SETUPTOOLS_USE_DISTUTILS=stdlib
ENV CUDA_HOME=/usr/local/cuda-11.3/
RUN conda update conda -y
# Avoid interactive prompts during build
ENV DEBIAN_FRONTEND=noninteractive
# Install libraries in the brand new image.
RUN apt-get -y update && apt-get install -y --no-install-recommends \
wget \
build-essential \
git \
python3-opencv \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
wget \
python3.8 \
python3-pip \
python3-venv \
python3-opencv \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory for all the subsequent Dockerfile instructions.
WORKDIR /opt/program
WORKDIR /app
# Clone GroundingDINO repo
RUN git clone https://github.com/IDEA-Research/GroundingDINO.git
RUN mkdir weights ; cd weights ; wget -q https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth ; cd ..
# Install Python dependencies
RUN pip install --upgrade pip && \
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113 && \
pip install networkx==2.6.3
RUN conda install -c "nvidia/label/cuda-12.1.1" cuda -y
ENV CUDA_HOME=$CONDA_PREFIX
# Install GroundingDINO requirements
RUN cd GroundingDINO && \
pip install -r requirements.txt && \
pip install -e .
ENV PATH=/usr/local/cuda/bin:$PATH
# Download pre-trained weights
RUN mkdir -p /app/weights && \
wget -P /app/weights https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
RUN cd GroundingDINO/ && python -m pip install .
# Environment variables
ENV PYTHONPATH=/app/GroundingDINO
ENV CUDA_VISIBLE_DEVICES=0
COPY docker_test.py docker_test.py
CMD [ "python", "docker_test.py" ]
# Use JSON array format for CMD
CMD ["bash", "-c", "cd GroundingDINO && python3 demo/gradio_app.py"]

View File

@ -248,6 +248,15 @@ cv2.imwrite("annotated_image.jpg", annotated_frame)
We also provide a demo code to integrate Grounding DINO with Gradio Web UI. See the file `demo/gradio_app.py` for more details.
**Running Web UI with Docker**
To run the web UI using Docker, first build and run the container:
```bash
docker build -t grounding_dino .
docker run --gpus all --network host -it grounding_dino
```
**Notebooks**
- We release [demos](demo/image_editing_with_groundingdino_gligen.ipynb) to combine [Grounding DINO](https://arxiv.org/abs/2303.05499) with [GLIGEN](https://github.com/gligen/GLIGEN) for more controllable image editings.