Open VSCode -> Click Extension -> Search below -> Install
Markdown Preview Enhanced
Material Icon Theme
Path Intellisense
This guide provides detailed steps to set up and install Ultralyitcs YOLO with CUDA Toolkit 11.7 and Anaconda for virtual environment management.
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.
1 Visit OBS Studio website
- Go to Download OBS
- Installation
- Follow the on-screen prompts to download and install OBS on your system.
To leverage GPU acceleration, you need to install the CUDA Toolkit 11.7. Follow these steps:
-
Visit the CUDA Toolkit 11.7 download page and select the version appropriate for your operating system.
-
After installation, verify it by running:
nvcc --version
(This should return details of CUDA 11.7 if the installation was successful.)
Anaconda will help manage your virtual environments. You can install Anaconda by following these steps:
-
Download the installer from the Official Anaconda website downloader.
-
Run the installer and follow the on-screen instructions.
For detailed instructions, refer to the official CONDA Documentation
-
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
- to create conda command example:
-
Activate the Conda environment that you created
-
Check list all environments in Conda:
conda info --envs
-
Activate your environment:
conda activate yolodrone-env
After activated, the console will display as below:
(env-name) D:\path\to\project\yolo-drone-detector>
-
(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')
-
-
Install dependencies from
requirements.txt
:- Check the location of
pip
:where pip
- Install required dependencies listed in
requirements.txt
(The download may take around 5-10 minutes.)pip install -r requirements.txt
- After dowloaded
requirements.txt
, Let's try to runmain.py
by following command:(The model will process using the CPU.)python src\main.py
- Check the location of
-
(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
-
After pip installing
PyTorch with cu117 (CUDA 11.7)
, Let's try to runmain.py
by following command:python src\main.py
-
-
(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.
-
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'
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!