diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..729e770 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + push: + branches: + - develop + workflow_dispatch: + +jobs: + docker: + runs-on: runner + env: + NAME: lone/xunlian + steps: + - name: Checkout + uses: https://git.ailuowan.com/deploy/checkout@v4 + + - name: Login Registry + run: | + echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ vars.REGISTRY }} -u "${{ vars.REGISTRY_USERNAME }}" --password-stdin + + - name: Docker build + run: | + docker buildx build --load \ + -f Dockerfile \ + -t ${{ vars.REGISTRY }}/$NAME:latest \ + . + + - name: Docker push + run: | + docker push ${{ vars.REGISTRY }}/$NAME:latest diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec45b4a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.pt +__pycache__/ + +runs/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3cc99f2..1fcd407 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ -# YOLOv8 training environment (NVIDIA GPU) +# YOLOv8 training image (NVIDIA GPU) # -# The image contains Python, PyTorch and Ultralytics only. The project -# directory (including data.yaml, train/valid/test and *.pt files) is mounted -# at /workspace when the container is started; this keeps the image small. +# Image contains Python / PyTorch / Ultralytics + train script. +# Dataset (*.pt weights, /data/facepp, runs/) are mounted at runtime. FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04 @@ -22,11 +21,10 @@ RUN apt-get update \ libxext6 \ libxrender1 \ python3 \ - python3-dev \ python3-pip \ && rm -rf /var/lib/apt/lists/* -# PyTorch 2.5.1 is paired with torchvision 0.20.1 and CUDA 12.4. +# PyTorch 2.5.1 + torchvision 0.20.1 (CUDA 12.4) RUN python3 -m pip install --upgrade pip \ && python3 -m pip install \ torch==2.5.1 \ @@ -36,8 +34,7 @@ RUN python3 -m pip install --upgrade pip \ WORKDIR /workspace -# These files make the image usable for a quick smoke test. The normal run -# command mounts the whole project over /workspace. COPY train_yolov8.py data.yaml ./ ENTRYPOINT ["python3", "train_yolov8.py"] +CMD ["--model", "yolov8n.pt", "--device", "0"] diff --git a/__pycache__/train_yolov8.cpython-39.pyc b/__pycache__/train_yolov8.cpython-39.pyc deleted file mode 100644 index 4cdd1d1..0000000 Binary files a/__pycache__/train_yolov8.cpython-39.pyc and /dev/null differ diff --git a/data.yaml b/data.yaml index 4cd9956..62f1337 100644 --- a/data.yaml +++ b/data.yaml @@ -1,7 +1,7 @@ path: . -train: train/images -val: valid/images -test: test/images +train: /data/facepp/train/images +val: /data/facepp/valid/images +test: /data/facepp/test/images nc: 11 names: ['0', '1', '10', '2', '3', '4', '5', '6', '7', '8', '9'] diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..d78456a --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,16 @@ +services: + xunlian: + image: git.ailuowan.com/lone/xunlian:latest + gpus: all + volumes: + - ./yolov8n.pt:/workspace/yolov8n.pt:ro + - ./yolov8m.pt:/workspace/yolov8m.pt:ro + - ./yolo26n.pt:/workspace/yolo26n.pt:ro + - /data/facepp:/data/facepp:ro + + - ./runs:/workspace/runs + environment: + TZ: Asia/Shanghai + NVIDIA_VISIBLE_DEVICES: all + NVIDIA_DRIVER_CAPABILITIES: compute,utility + restart: "no"