Running YOLO V7 on Windows 10/11

Jul 18, 2024

Running YOLO V7 on Windows 10/11

Requirements

  • Hardware: Laptop/PC, GPU (optional but recommended), Internet connection
  • Software: Python 3, Conda

Installing Conda

  1. Download Conda: Go to the Conda website and choose Anaconda from the versions (Anaconda, Miniconda, Anaconda Enterprise)
  2. Install:
    • Click the Windows download button (600MB file)
    • Agree to terms, select installation type (Just Me), and add Anaconda to the PATH environment variable
    • Click Install

Creating Conda Environment

  1. Create Environment:

    • Open Command Prompt
    • Type: conda create --name any_env_name
    • Activate with: conda activate any_env_name
  2. Clone YOLO V7 Repository:

    • Use git: git clone [YOLO V7 link]
  3. Install Required Packages:

    • Use pip: pip install -r requirements.txt

Downloading Pre-trained Weights

  1. Access Weights:
    • Available on YOLO V7 GitHub repository
    • Look for YOLO v7.pt under the testing section
  2. Save Weights:
    • Place them in the YOLO V7 folder

Detection on Images using GPU

  1. Install CUDA:
    • Install NVIDIA CUDA toolkit compatible with your GPU and system
    • Download and install from NVIDIA website
  2. GPU Setup:
    • Ensure python detect.py --weights [path] --conf 0.5 --img-size [size] --source [image file] --device 0
    • Run the detection code
    • Check result in YOLO V7 runs/detect/experiment folder

Detection on Images using CPU

  1. Change Device Setting:
    • Set device to CPU --device cpu
    • Detection will take longer
    • Results saved similarly in runs/detect/experiment folder

Detection on Videos

  1. Source Setup:
    • Replace source from image to video file path --source [video file]
    • Process similarly as with images
  2. Run the Model:
    • Check results in runs/detect/experiment folder

Detection via Webcam

  1. Setup Source:
    • Change source to 0 for inbuilt webcam
    • Change to 1 for an external webcam

YOLO V7 Custom Training (Brief Mention)

  • Tutorial based on official YOLO V7 repository instructions.