2020-05-30 08:04:54 +08:00
|
|
|
# Start FROM Nvidia PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
|
2021-03-03 05:01:59 +08:00
|
|
|
FROM nvcr.io/nvidia/pytorch:21.02-py3
|
2020-08-01 02:10:03 +08:00
|
|
|
|
2020-12-10 11:01:08 +08:00
|
|
|
# Install linux packages
|
2021-02-28 07:55:31 +08:00
|
|
|
RUN apt update && apt install -y zip htop screen libgl1-mesa-glx
|
2020-12-10 11:01:08 +08:00
|
|
|
|
|
|
|
# Install python dependencies
|
2021-01-25 03:54:15 +08:00
|
|
|
RUN python -m pip install --upgrade pip
|
2020-12-23 12:53:44 +08:00
|
|
|
COPY requirements.txt .
|
2021-03-06 07:26:27 +08:00
|
|
|
RUN pip install --no-cache -r requirements.txt gsutil notebook
|
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
|
|
|
|
COPY . /usr/src/app
|
|
|
|
|
|
|
|
# Copy weights
|
|
|
|
#RUN python3 -c "from models import *; \
|
|
|
|
#attempt_download('weights/yolov5s.pt'); \
|
|
|
|
#attempt_download('weights/yolov5m.pt'); \
|
|
|
|
#attempt_download('weights/yolov5l.pt')"
|
|
|
|
|
|
|
|
|
|
|
|
# --------------------------------------------------- Extras Below ---------------------------------------------------
|
|
|
|
|
|
|
|
# Build and Push
|
|
|
|
# t=ultralytics/yolov5:latest && sudo docker build -t $t . && sudo docker push $t
|
2020-08-14 05:25:05 +08:00
|
|
|
# for v in {300..303}; do t=ultralytics/coco:v$v && sudo docker build -t $t . && sudo docker push $t; done
|
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
|
2020-07-14 04:30:57 +08:00
|
|
|
# t=ultralytics/yolov5:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/coco:/usr/src/coco $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
|
|
|
|
2020-05-31 00:49:11 +08:00
|
|
|
# Bash into running container
|
2021-01-23 06:26:58 +08:00
|
|
|
# sudo docker exec -it 5a9b5863d93d bash
|
2020-05-30 08:04:54 +08:00
|
|
|
|
2020-05-31 00:49:11 +08:00
|
|
|
# Bash into stopped container
|
2021-01-27 09:30:42 +08:00
|
|
|
# id=$(sudo docker ps -qa) && sudo docker start $id && sudo docker exec -it $id bash
|
2020-07-16 08:40:19 +08:00
|
|
|
|
|
|
|
# Send weights to GCP
|
2020-11-09 02:39:05 +08:00
|
|
|
# python -c "from utils.general import *; strip_optimizer('runs/train/exp0_*/weights/best.pt', 'tmp.pt')" && gsutil cp tmp.pt gs://*.pt
|
2020-05-30 08:04:54 +08:00
|
|
|
|
|
|
|
# Clean up
|
2020-07-16 08:40:19 +08:00
|
|
|
# docker system prune -a --volumes
|