2021-11-14 22:22:59 +01:00
|
|
|
# YOLOv3 🚀 by Ultralytics, GPL-3.0 license
|
2023-02-11 15:20:10 +04:00
|
|
|
# Builds ultralytics/yolov5:latest image on DockerHub https://hub.docker.com/r/ultralytics/yolov3
|
|
|
|
|
# Image is CUDA-optimized for YOLOv5 single/multi-GPU training and inference
|
2021-11-14 22:22:59 +01:00
|
|
|
|
2023-02-11 02:13:22 +04:00
|
|
|
# Start FROM NVIDIA PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
|
|
|
|
|
# FROM docker.io/pytorch/pytorch:latest
|
|
|
|
|
FROM pytorch/pytorch:latest
|
|
|
|
|
|
|
|
|
|
# Downloads to user config dir
|
|
|
|
|
ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
|
2020-11-26 20:24:00 +01:00
|
|
|
|
2020-12-22 17:48:40 -08:00
|
|
|
# Install linux packages
|
2023-02-11 02:13:22 +04:00
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
|
RUN apt update
|
|
|
|
|
RUN TZ=Etc/UTC apt install -y tzdata
|
|
|
|
|
RUN apt install --no-install-recommends -y gcc git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg
|
|
|
|
|
# RUN alias python=python3
|
2020-12-22 17:48:40 -08:00
|
|
|
|
2023-02-11 02:13:22 +04:00
|
|
|
# Security updates
|
|
|
|
|
# https://security.snyk.io/vuln/SNYK-UBUNTU1804-OPENSSL-3314796
|
|
|
|
|
RUN apt upgrade --no-install-recommends -y openssl
|
2019-09-04 13:11:17 +02:00
|
|
|
|
2019-09-09 02:13:39 +02:00
|
|
|
# Create working directory
|
2023-02-11 02:13:22 +04:00
|
|
|
RUN rm -rf /usr/src/app && mkdir -p /usr/src/app
|
2019-09-09 02:13:39 +02:00
|
|
|
WORKDIR /usr/src/app
|
2019-08-29 18:58:09 +02:00
|
|
|
|
2019-09-09 02:13:39 +02:00
|
|
|
# Copy contents
|
2023-02-11 02:13:22 +04:00
|
|
|
# COPY . /usr/src/app (issues as not a .git directory)
|
2023-02-11 15:20:10 +04:00
|
|
|
RUN git clone https://github.com/ultralytics/yolov5 /usr/src/app
|
2019-08-29 18:58:09 +02:00
|
|
|
|
2023-02-11 02:13:22 +04:00
|
|
|
# Install pip packages
|
|
|
|
|
COPY requirements.txt .
|
|
|
|
|
RUN python3 -m pip install --upgrade pip wheel
|
|
|
|
|
RUN pip install --no-cache -r requirements.txt albumentations comet gsutil notebook \
|
|
|
|
|
coremltools onnx onnx-simplifier onnxruntime 'openvino-dev>=2022.3'
|
|
|
|
|
# tensorflow tensorflowjs \
|
2021-11-14 22:22:59 +01:00
|
|
|
|
2021-04-12 18:00:47 +02:00
|
|
|
# Set environment variables
|
2023-02-11 02:13:22 +04:00
|
|
|
ENV OMP_NUM_THREADS=1
|
|
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
|
ENV DEBIAN_FRONTEND teletype
|
2021-04-12 18:00:47 +02:00
|
|
|
|
2019-09-09 19:15:17 +02:00
|
|
|
|
2021-11-14 22:22:59 +01:00
|
|
|
# Usage Examples -------------------------------------------------------------------------------------------------------
|
2019-08-29 18:58:09 +02:00
|
|
|
|
2019-12-07 15:06:38 -08:00
|
|
|
# Build and Push
|
2023-02-11 15:20:10 +04:00
|
|
|
# t=ultralytics/yolov5:latest && sudo docker build -f utils/docker/Dockerfile -t $t . && sudo docker push $t
|
2019-08-29 18:58:09 +02:00
|
|
|
|
2020-11-26 20:24:00 +01:00
|
|
|
# Pull and Run
|
2023-02-11 15:20:10 +04:00
|
|
|
# t=ultralytics/yolov5:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t
|
2019-09-04 14:08:39 +02:00
|
|
|
|
2019-10-09 03:16:27 +02:00
|
|
|
# Pull and Run with local directory access
|
2023-02-11 15:20:10 +04:00
|
|
|
# t=ultralytics/yolov5:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/datasets:/usr/src/datasets $t
|
2019-10-09 03:16:27 +02:00
|
|
|
|
2019-09-16 21:08:14 +02:00
|
|
|
# Kill all
|
2020-11-26 20:24:00 +01:00
|
|
|
# sudo docker kill $(sudo docker ps -q)
|
2019-09-09 19:15:17 +02:00
|
|
|
|
2019-12-27 10:08:58 -08:00
|
|
|
# Kill all image-based
|
2023-02-11 15:20:10 +04:00
|
|
|
# sudo docker kill $(sudo docker ps -qa --filter ancestor=ultralytics/yolov5:latest)
|
2020-11-26 20:24:00 +01:00
|
|
|
|
2023-02-11 02:13:22 +04:00
|
|
|
# DockerHub tag update
|
2023-02-11 15:20:10 +04:00
|
|
|
# t=ultralytics/yolov5:latest tnew=ultralytics/yolov5:v6.2 && sudo docker pull $t && sudo docker tag $t $tnew && sudo docker push $tnew
|
2020-11-26 20:24:00 +01:00
|
|
|
|
|
|
|
|
# Clean up
|
2023-02-11 02:13:22 +04:00
|
|
|
# sudo docker system prune -a --volumes
|
2021-11-14 22:22:59 +01:00
|
|
|
|
|
|
|
|
# Update Ubuntu drivers
|
|
|
|
|
# https://www.maketecheasier.com/install-nvidia-drivers-ubuntu/
|
|
|
|
|
|
|
|
|
|
# DDP test
|
|
|
|
|
# python -m torch.distributed.run --nproc_per_node 2 --master_port 1 train.py --epochs 3
|
2023-02-11 02:13:22 +04:00
|
|
|
|
|
|
|
|
# GCP VM from Image
|
2023-02-11 15:20:10 +04:00
|
|
|
# docker.io/ultralytics/yolov5:latest
|