Creating YOLO docker image

posted by Anil Kumar Shrestha on 2020-08-25

  1. Create Dockerfile in root of the project.
FROM nvidia/cuda:10.1-cudnn8-devel-ubuntu18.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt update && apt install -y git pkg-config libopencv-dev
RUN cd /root && git clone && cd darknet && sed -i 's/GPU=0/GPU=1/; s/CUDNN=0/CUDNN=1/; s/OPENCV=0/OPENCV=1/' Makefile && make
COPY yolov4.weights /root/darknet/
WORKDIR /root/darknet
  1. Build Image:

    docker build . -t yolo:v0.1
  2. Run inference:
docker run --name yolo -it -v /mnt/disk1/object-detection/anil/yolo/:/root/yolo --gpus all --rm yolo:0.1 ./darknet detector test cfg/ cfg/yolov4.cfg yolov4.weights -thresh 0.25