Skip to content

Nukaze/yolo-drone-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

** Before readme **

Open VSCode -> Click Extension -> Search below -> Install

Markdown Preview Enhanced
Material Icon Theme
Path Intellisense

Ultralyitcs YOLO Setup and Installation

This guide provides detailed steps to set up and install Ultralyitcs YOLO with CUDA Toolkit 11.7 and Anaconda for virtual environment management.

Prerequisites

Before you begin, ensure that you have:

  • Python installed for AI Development.
  • OBS Studio installed for Video Stream.
  • NVIDIA GPU with support for CUDA.
  • Anaconda installed on your system (for virtual environment management).
  • CUDA Toolkit 11.7 installed.
  • Ultralytics YOLO is an AI framework specialized in real-time object detection using Deep Learning.

#Step 1: OBS Studio (For virtual camera)

1 Visit OBS Studio website

  1. Installation
    • Follow the on-screen prompts to download and install OBS on your system.

#Step 2: Install CUDA Toolkit 11.7

To leverage GPU acceleration, you need to install the CUDA Toolkit 11.7. Follow these steps:

  1. Visit the CUDA Toolkit 11.7 download page and select the version appropriate for your operating system.

    • select according to your pc or laptop Windows --> x86_64 --> 10 --> exe (network) cuda_select_installer
    • And follow on-screen prompts (this process will take 10-20 minutes depend on pc, internet, etc)
  2. After installation, verify it by running:

    nvcc --version

    (This should return details of CUDA 11.7 if the installation was successful.) nvcc show version

Step 3: Install Anaconda

Anaconda will help manage your virtual environments. You can install Anaconda by following these steps:

  1. Download the installer from the Official Anaconda website downloader.

  2. Run the installer and follow the on-screen instructions.

  • Anaconda_install_options
  1. Verify the installation by running:

    conda --version

    conda_version

Step 4: Set Up the Virtual Environment for Your Project

For detailed instructions, refer to the official CONDA Documentation

  1. Create a new Anaconda environment and install dependencies from the requirements.txt file:

    • to create conda command example: conda create --name <env-name>
    • to create new environment from scratch:
      conda create -n yolodrone-env python=3.9
    • to re-create environment using a pre-configured environment.yml (if provided):
      conda env create -f environment.yml
  2. Activate the Conda environment that you created

    • Check list all environments in Conda:

      conda info --envs

      conda envs info

    • Activate your environment:

      conda activate yolodrone-env

      After activated, the console will display as below: (env-name) D:\path\to\project\yolo-drone-detector> conda activated

    • (Optional) Remove a Conda environment if needed:

      conda remove -n <env-name> --all

    2.5 Let's try to run main.py by following command:

    python src\main.py

    (You should encounter an error: ModuleNotFoundError: No module named 'cv2') try_python_run_1

  3. Install dependencies from requirements.txt:

    • Check the location of pip:
      where pip
      where_pip
    • Install required dependencies listed in requirements.txt
      pip install -r requirements.txt
      (The download may take around 5-10 minutes.) pip_install_req
    • After dowloaded requirements.txt, Let's try to run main.py by following command:
      python src\main.py
      (The model will process using the CPU.) run_on_cpu
  4. (Optional, for NVIDIA GPU users) Install PyTorch with CUDA support by following the instructions from the PyTorch website. For this workshop using PyTorch CUDA 11.7:

    • pip install PyTorch and it's dependencies using below:

      pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

      pip_install_pytorch_cuda

    • After pip installing PyTorch with cu117 (CUDA 11.7), Let's try to run main.py by following command:

      python src\main.py

      (The model will process using the NVIDIA GPU.) run_on_cuda

  5. (Optional) Export Conda Environment for Use on Another PC or Machine To export your Conda environment so it can be easily recreated on another system

    • Export the environment

      conda env export > environment.yml
    • Recreating the environment (On another machine, you can recreate the environment using):

      conda env create -f environment.yml

    Result of environment.yml, ensuring consistent and portable environments across different systems. environment_yml

#Step 5: TODO

Once the installation is complete, you can activate the environment using:

conda activate yolov8-env

Now you can use the yolo command to run YOLOv8:

yolo task=detect mode=predict model=yolov8n.pt source='path/to/your/image_or_video'

Step 6: Verify Installation

To verify everything works fine, you can run a simple command to check if YOLOv8 is installed correctly:

python -c "import ultralytics; ultralytics.checks()"

If you get no errors, you are all set!


Additional Resources

About

Made for Saturday Dev Club

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published