Readme file changing, test bash script changing, Folder order changing (PROJECTS/DATA and PROJECTS/RESULTS)

pull/2127/head
Gorkem KOCATURK 2025-04-15 15:08:03 +03:00
parent d0dbbb5ef5
commit 5f19b9e76b
18 changed files with 194 additions and 26 deletions

View File

@ -1,37 +1,110 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
# Builds ultralytics/ultralytics:latest image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
# Image is CUDA-optimized for YOLO11 single/multi-GPU training and inference
# Start FROM PyTorch image https://hub.docker.com/r/pytorch/pytorch or nvcr.io/nvidia/pytorch:23.03-py3
# 📦 STEP 1: Use NVIDIA's Official PyTorch Image
FROM nvcr.io/nvidia/pytorch:23.08-py3
# 🔥 Comes pre-installed with:
# - Ubuntu 22.04 including Python 3.10
# - NVIDIA CUDA® 12.2.1
# - NVIDIA cuBLAS 12.2.5.1
# - NVIDIA cuDNN 8.9.4
# - NVIDIA NCCL 2.18.3
# - NVIDIA RAPIDS™ 23.06
# - Apex
# - rdma-core 39.0
# - NVIDIA HPC-X 2.15
# - OpenMPI 4.1.4+
# - GDRCopy 2.3
# - TensorBoard 2.9.0
# - Nsight Compute 2023.2.1.3
# - Nsight Systems 2023.2.3.1001
# - NVIDIA TensorRT™ 8.6.1.6
# - Torch-TensorRT 2.0.0.dev0
# - NVIDIA DALI® 1.28.0
# - MAGMA 2.6.2
# - JupyterLab 2.3.2 including Jupyter-TensorBoard
# - TransformerEngine 0.11.0++3f01b4f
# - PyTorch quantization wheel 2.1.2
# Saves time & ensures GPU compatibility!
# 🛠 STEP 2: Install Basic Linux Packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 libsm6 \
gcc \
git \
zip unzip \
wget curl \
htop \
libgl1 \
libglib2.0-0 \
libpython3-dev \
gnupg \
g++ \
libusb-1.0-0 \
libsm6 \
&& rm -rf /var/lib/apt/lists/*
# 🚿 Clean-up: Shrinks the image size by removing cached lists
# Security updates
# https://security.snyk.io/vuln/SNYK-UBUNTU1804-OPENSSL-3314796
# 🔐 STEP 3: Apply Security Updates for Core Packages
RUN apt upgrade --no-install-recommends -y openssl tar
# 🚨 Patch critical vulnerabilities in OpenSSL (network encryption) & tar (archives)
# Create working directory
# 📁 STEP 4: Set Working Directory
WORKDIR /app
# All following commands will execute in /app inside the container
# Install requirements
# 🧪 STEP 5: Install Python Requirements
COPY requirements.txt .
RUN pip install -r requirements.txt
# 📦 Installs YOLOv7 dependencies (torchvision, opencv-python, numpy, etc.)
# Install OpenCV with CUDA support
# 📂 STEP 6: Copy Source Code to the Container
COPY . .
RUN rm -rf ./workspace
RUN bash scripts/build_opencv.sh
# ✅ Adds your whole project directory into the container at /app
# Test CUDA and OpenCV support
# 🧹 Clean Up Pre-existing Workspace (Optional)
RUN rm -rf ./workspace
# 💡 Ensures the build is fresh & avoids legacy artifacts
# ⚙️ STEP 7: Build OpenCV with CUDA Support
RUN bash scripts/build_opencv.sh
# 🚀 This script compiles OpenCV from source with GPU acceleration for video/image ops
# 😎 Perfect for fast inference on large datasets
# ✅ STEP 8: Run Diagnostic Tests
RUN bash scripts/test-cmds.sh
RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt # Recommend for lower specs
# RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7x.pt
# RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6.pt # Recommend for train_aux.py training
# RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6.pt
# RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-d6.pt
RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt # Recommend for high specs
# 🧪 Verifies:
# - OpenCV is properly installed
# - CUDA is working
# - Everythings talking to each other correctly
# ⬇️ STEP 9: Download YOLOv7 Pretrained Models
# ⚠️ Choose the one that matches your hardware & use case
# 🏃‍♂️ Lightweight Model Fast AF
RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt
# Use this for: 🔋 embedded systems, Raspberry Pi, Jetson Nano
# Speed ✅ Accuracy ❌
# 🧠 Balanced Model Best for Most
RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7x.pt
# Use this for: 🧪 general object detection on mid-range GPUs
# Speed ⚖️ Accuracy ⚖️
# 🔧 Training-Ready For Custom Datasets
RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6.pt
# Use this for: 🏋️‍♂️ training with `train_aux.py`
# Comes with extra layers for learning better
# 🎯 Precision Model Accuracy First
RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6.pt
# Use this for: 📸 detection where precision matters
# Speed ❌ Accuracy ✅✅
# 🧬 Deep Variant Alternate Heavyweight
RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-d6.pt
# Use this if: Youre experimenting or need d6-specific layers
# 👑 Elite Model Max Accuracy, Max Power
RUN wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt
# Use this for: 🖥️ high-end workstations, servers
# Speed ❌❌ Accuracy 💯

View File

@ -0,0 +1 @@
0 0.421296 0.127930 0.057870 0.074219

View File

@ -0,0 +1 @@
0 0.451582 0.119141 0.063657 0.078125

View File

@ -0,0 +1 @@
0 0.427662 0.118408 0.063657 0.084473

View File

@ -0,0 +1 @@
0 0.424576 0.117188 0.069059 0.075195

View File

@ -0,0 +1 @@
0 0.416088 0.120117 0.060571 0.077148

View File

@ -0,0 +1 @@
0 0.412616 0.120361 0.070602 0.078613

View File

@ -0,0 +1 @@
0 0.444059 0.120850 0.067130 0.077637

View File

@ -0,0 +1 @@
0 0.440008 0.120605 0.060571 0.075195

View File

@ -44,7 +44,9 @@ Your existing machine to give a gpu capabilities to existing docker containers.
If you have trouble about can not see cuda in your existing machine try `privileged` parameter:
```shell
docker run --gpus all --privileged --rm -it barisx/yolov7-cuda-opencv:latest
docker run --gpus all -it --rm --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --privileged \
-v /home/grkm/Documents/yolov7-cuda-opencv/PROJECTS/DATA \
-v /home/grkm/Documents/yolov7-cuda-opencv/PROJECTS/RESULTS \
```
After you can check it:

View File

@ -1,4 +1,89 @@
python -c "import cv2;print(cv2.cuda.getCudaEnabledDeviceCount())"
python3 -c "import cv2;print(cv2.cuda.getCudaEnabledDeviceCount())"
dpkg -l | grep "opencv"
python -c "import torch;print(torch.cuda.is_available())"
#!/bin/bash
# Title
echo "🧪 SYSTEM DIAGNOSTIC TEST SCRIPT FOR AI/ML ENVIRONMENT"
##########################
# Function: Test OpenCV
##########################
test_opencv() {
echo "-------------------Testing OpenCV installation (START)---------------------"
echo "📦 Checking OpenCV installation and version..."
python3 -c "import cv2; print(f' OpenCV version: {cv2.__version__}')"
echo "⚙️ Checking OpenCV build flags for CUDA..."
python3 -c "import cv2; print(cv2.getBuildInformation())" | grep "CUDA"
echo "🚀 Checking if OpenCV can access CUDA-enabled GPU..."
python3 -c "import cv2; print(' ✅ CUDA is enabled for OpenCV') if cv2.cuda.getCudaEnabledDeviceCount() else print(' ❌ CUDA is NOT enabled for OpenCV')"
echo "-------------------Testing OpenCV installation (END)---------------------"
echo "/"
}
##########################
# Function: Test PyTorch
##########################
test_torch() {
echo "-------------------Testing PyTorch installation (START)---------------------"
echo "📦 Checking PyTorch installation and version..."
python3 -c "import torch; print(f' Torch version: {torch.__version__}')"
echo "🚀 Checking if PyTorch can access CUDA-enabled GPU..."
python3 -c "import torch; print(' ✅ CUDA is enabled for Torch') if torch.cuda.is_available() else print(' ❌ CUDA is NOT enabled for Torch')"
echo "-------------------Testing PyTorch installation (END)---------------------"
echo "/"
}
##########################
# Function: Test NVCC (CUDA Compiler)
##########################
test_nvcc() {
echo "-------------------Testing nvcc installation (START)---------------------"
echo "📦 Checking nvcc (NVIDIA CUDA Compiler) version..."
output=$(nvcc --version)
compiler=$(echo "$output" | grep "nvcc:" | cut -d ':' -f2- | sed 's/^/ /')
build_date=$(echo "$output" | grep "Built on" | sed 's/Built on //; s/_/ /g')
cuda_version=$(echo "$output" | grep "Cuda compilation tools" | sed -E 's/.*release ([^,]+), V([0-9\.]+).*/\1 (\2)/')
build_id=$(echo "$output" | grep "Build cuda")
echo "🧠 CUDA Compiler Information:"
echo "- Compiler: $compiler"
echo "- CUDA Version: $cuda_version"
echo "- Build Date: $build_date"
echo "- Internal Build ID: $build_id"
echo "-------------------Testing nvcc installation (END)---------------------"
echo "/"
}
##########################
# Function: Test NVIDIA-SMI (Driver & GPU)
##########################
test_nvidia_smi() {
echo "-------------------Testing nvidia-smi installation (START)---------------------"
echo "🖥️ GPU and driver status:"
nvidia-smi
echo "-------------------Testing nvidia-smi installation (END)---------------------"
}
##########################
# Main: Run All Tests
##########################
run_all_tests() {
test_opencv
test_torch
test_nvcc
test_nvidia_smi
}
# Execute
run_all_tests
echo "-------------------All tests completed!---------------------"