2021-11-14 22:22:59 +01:00
|
|
|
# YOLOv3 🚀 by Ultralytics, GPL-3.0 license
|
|
|
|
|
|
2019-11-30 12:43:41 -08:00
|
|
|
# Start FROM Nvidia PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
|
2021-11-14 22:22:59 +01:00
|
|
|
FROM nvcr.io/nvidia/pytorch:21.10-py3
|
2020-11-26 20:24:00 +01:00
|
|
|
|
2020-12-22 17:48:40 -08:00
|
|
|
# Install linux packages
|
2021-04-12 18:00:47 +02:00
|
|
|
RUN apt update && apt install -y zip htop screen libgl1-mesa-glx
|
2020-12-22 17:48:40 -08:00
|
|
|
|
|
|
|
|
# Install python dependencies
|
|
|
|
|
COPY requirements.txt .
|
2021-04-12 18:00:47 +02:00
|
|
|
RUN python -m pip install --upgrade pip
|
|
|
|
|
RUN pip uninstall -y nvidia-tensorboard nvidia-tensorboard-plugin-dlprof
|
2021-11-14 22:22:59 +01:00
|
|
|
RUN pip install --no-cache -r requirements.txt coremltools onnx gsutil notebook wandb>=0.12.2
|
|
|
|
|
RUN pip install --no-cache -U torch torchvision numpy Pillow
|
|
|
|
|
# RUN pip install --no-cache torch==1.10.0+cu113 torchvision==0.11.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
|
2019-09-04 13:11:17 +02:00
|
|
|
|
2019-09-09 02:13:39 +02:00
|
|
|
# Create working directory
|
|
|
|
|
RUN mkdir -p /usr/src/app
|
|
|
|
|
WORKDIR /usr/src/app
|
2019-08-29 18:58:09 +02:00
|
|
|
|
2019-09-09 02:13:39 +02:00
|
|
|
# Copy contents
|
|
|
|
|
COPY . /usr/src/app
|
2019-08-29 18:58:09 +02:00
|
|
|
|
2021-11-14 22:22:59 +01:00
|
|
|
# Downloads to user config dir
|
|
|
|
|
ADD https://ultralytics.com/assets/Arial.ttf /root/.config/Ultralytics/
|
|
|
|
|
|
2021-04-12 18:00:47 +02:00
|
|
|
# Set environment variables
|
2021-11-14 22:22:59 +01:00
|
|
|
# ENV HOME=/usr/src/app
|
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
|
2020-11-26 20:24:00 +01:00
|
|
|
# t=ultralytics/yolov3:latest && sudo docker build -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
|
2021-01-12 23:05:32 -08:00
|
|
|
# t=ultralytics/yolov3: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
|
2021-11-14 22:22:59 +01:00
|
|
|
# t=ultralytics/yolov3: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
|
2021-11-14 22:22:59 +01:00
|
|
|
# sudo docker kill $(sudo docker ps -qa --filter ancestor=ultralytics/yolov3:latest)
|
2020-11-26 20:24:00 +01:00
|
|
|
|
|
|
|
|
# Bash into running container
|
2021-04-12 18:00:47 +02:00
|
|
|
# sudo docker exec -it 5a9b5863d93d bash
|
2020-11-26 20:24:00 +01:00
|
|
|
|
|
|
|
|
# Bash into stopped container
|
2021-04-12 18:00:47 +02:00
|
|
|
# id=$(sudo docker ps -qa) && sudo docker start $id && sudo docker exec -it $id bash
|
2020-11-26 20:24:00 +01:00
|
|
|
|
|
|
|
|
# Clean up
|
|
|
|
|
# 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
|