2021-08-15 03:17:51 +08:00
|
|
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
2022-05-30 02:43:01 +08:00
|
|
|
# Builds ultralytics/yolov5:latest image on DockerHub https://hub.docker.com/r/ultralytics/yolov5
|
|
|
|
# Image is CUDA-optimized for YOLOv5 single/multi-GPU training and inference
|
2021-08-15 03:17:51 +08:00
|
|
|
|
2022-05-04 04:47:30 +08:00
|
|
|
# Start FROM NVIDIA PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
|
2023-02-06 19:11:32 +08:00
|
|
|
# FROM docker.io/pytorch/pytorch:latest
|
|
|
|
FROM pytorch/pytorch:latest
|
2022-05-04 04:47:30 +08:00
|
|
|
|
|
|
|
# Downloads to user config dir
|
|
|
|
ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
|
2020-08-01 02:10:03 +08:00
|
|
|
|
2020-12-10 11:01:08 +08:00
|
|
|
# Install linux packages
|
2023-02-06 19:11:32 +08: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-10 11:01:08 +08:00
|
|
|
|
2023-02-06 19:11:32 +08:00
|
|
|
# Create working directory
|
|
|
|
RUN mkdir -p /usr/src/app
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
# Copy contents
|
|
|
|
# COPY . /usr/src/app (issues as not a .git directory)
|
|
|
|
RUN git clone https://github.com/ultralytics/yolov5 /usr/src/app
|
|
|
|
|
|
|
|
# Install pip packages
|
2020-12-23 12:53:44 +08:00
|
|
|
COPY requirements.txt .
|
2023-02-06 19:11:32 +08:00
|
|
|
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 \
|
2020-08-16 00:53:22 +08:00
|
|
|
|
2020-05-30 08:04:54 +08:00
|
|
|
# Create working directory
|
|
|
|
RUN mkdir -p /usr/src/app
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
# Copy contents
|
2022-08-02 03:45:31 +08:00
|
|
|
# COPY . /usr/src/app (issues as not a .git directory)
|
|
|
|
RUN git clone https://github.com/ultralytics/yolov5 /usr/src/app
|
2020-05-30 08:04:54 +08:00
|
|
|
|
2021-03-06 07:53:57 +08:00
|
|
|
# Set environment variables
|
2022-12-26 21:54:43 +08:00
|
|
|
ENV OMP_NUM_THREADS=1
|
2020-05-30 08:04:54 +08:00
|
|
|
|
2023-02-06 19:11:32 +08:00
|
|
|
# Cleanup
|
|
|
|
ENV DEBIAN_FRONTEND teletype
|
|
|
|
|
2020-05-30 08:04:54 +08:00
|
|
|
|
2021-06-26 22:09:56 +08:00
|
|
|
# Usage Examples -------------------------------------------------------------------------------------------------------
|
2020-05-30 08:04:54 +08:00
|
|
|
|
|
|
|
# Build and Push
|
2022-04-22 11:31:26 +08:00
|
|
|
# t=ultralytics/yolov5:latest && sudo docker build -f utils/docker/Dockerfile -t $t . && sudo docker push $t
|
2020-05-30 08:04:54 +08:00
|
|
|
|
|
|
|
# Pull and Run
|
2020-11-30 00:47:51 +08:00
|
|
|
# t=ultralytics/yolov5:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t
|
2020-05-30 08:04:54 +08:00
|
|
|
|
|
|
|
# Pull and Run with local directory access
|
2021-06-26 22:09:56 +08:00
|
|
|
# t=ultralytics/yolov5:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/datasets:/usr/src/datasets $t
|
2020-05-30 08:04:54 +08:00
|
|
|
|
|
|
|
# Kill all
|
2020-09-08 15:56:35 +08:00
|
|
|
# sudo docker kill $(sudo docker ps -q)
|
2020-05-30 08:04:54 +08:00
|
|
|
|
|
|
|
# Kill all image-based
|
2021-01-27 09:30:42 +08:00
|
|
|
# sudo docker kill $(sudo docker ps -qa --filter ancestor=ultralytics/yolov5:latest)
|
2020-05-30 08:04:54 +08:00
|
|
|
|
2022-08-18 04:50:08 +08:00
|
|
|
# DockerHub tag update
|
|
|
|
# t=ultralytics/yolov5:latest tnew=ultralytics/yolov5:v6.2 && sudo docker pull $t && sudo docker tag $t $tnew && sudo docker push $tnew
|
2020-07-16 08:40:19 +08:00
|
|
|
|
2020-05-30 08:04:54 +08:00
|
|
|
# Clean up
|
2023-01-14 19:40:15 +08:00
|
|
|
# sudo docker system prune -a --volumes
|
2021-09-20 18:22:24 +08:00
|
|
|
|
|
|
|
# Update Ubuntu drivers
|
|
|
|
# https://www.maketecheasier.com/install-nvidia-drivers-ubuntu/
|
2021-09-20 19:10:41 +08:00
|
|
|
|
|
|
|
# DDP test
|
|
|
|
# python -m torch.distributed.run --nproc_per_node 2 --master_port 1 train.py --epochs 3
|
2021-11-29 01:12:46 +08:00
|
|
|
|
|
|
|
# GCP VM from Image
|
|
|
|
# docker.io/ultralytics/yolov5:latest
|