3X Your Interview Chances
AI Resume Builder
Import LinkedIn, get AI suggestions, land more interviews
3 min to read
The You Only Look Once (YOLO) framework represents a seminal advancement in real-time object detection, widely implemented across domains such as autonomous navigation, surveillance, and robotics.
The latest iteration, YOLOv12, significantly improves computational efficiency and detection accuracy. This article presents a rigorous, stepwise approach to configuring and deploying YOLOv12 on Linux and Ubuntu systems.
Prior to installation, ensure that your system satisfies the following requirements:
sudo apt install git
python3 --version
Execute the following commands to install necessary system dependencies:
Install NVIDIA GPU Driver and CUDA (Optional): Refer to the NVIDIA Developer Portal for platform-specific instructions.
Install Git:
sudo apt install git
Install Python 3.11 or Later:
sudo apt update
sudo apt install python3.11
Clone the official YOLOv12 repository from GitHub:
git clone https://github.com/sunsmarterjie/yolov12.git
cd yolov12
Isolating dependencies within a virtual environment prevents conflicts and enhances reproducibility.
Using venv:
python3.11 -m venv yolov12-env
source yolov12-env/bin/activate
Using Conda:
conda create -n yolov12 python=3.11
conda activate yolov12
Install all requisite dependencies, including PyTorch and FlashAttention:
wget https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu11torch2.2cxx11abiFALSE-cp311-cp311-linux_x86_64.whl
pip install flash_attn-2.7.3+cu11torch2.2cxx11abiFALSE-cp311-cp311-linux_x86_64.whl
pip install -r requirements.txt
pip install -e .
Confirm the integrity of the installation with:
python -c "from ultralytics import YOLO; print('YOLOv12 installed successfully')"
Once configured, YOLOv12 can be deployed for object detection tasks.
The following Python script demonstrates inference on an image:
from ultralytics import YOLO
# Load the trained model
model = YOLO("path/to/model.pt") # Utilize a pre-trained model
# Perform inference
results = model("path/to/image.jpg")
# Post-process results
for result in results:
boxes = result.boxes # Bounding boxes
probs = result.probs # Confidence scores
# result.show() # Visualize output
result.save("output.jpg") # Store processed image
Given the iterative progression of YOLO models, subsequent versions are anticipated to offer superior efficiency and feature enhancements. Maintaining an updated computational environment, including Python and CUDA, ensures continued compatibility and optimal performance.
Command | Functionality |
---|---|
git clone https://github.com/sunsmarterjie/yolov12.git |
Clone the YOLOv12 repository |
conda create -n yolov12 python=3.11 |
Generate a dedicated Conda environment |
pip install -r requirements.txt |
Install project dependencies |
python -c "from ultralytics import YOLO; print('YOLOv12 installed successfully')" |
Verify installation |
YOLOv12 embodies state-of-the-art advancements in real-time object detection. By adhering to the procedural framework outlined in this guide, researchers and developers can efficiently establish and utilize YOLOv12 within Linux and Ubuntu environments, facilitating its deployment in diverse real-world applications.
Deploying YOLOv12 on Linux and Ubuntu involves methodical steps, including configuring the environment, acquiring the repository, setting up a virtual environment, installing dependencies, and performing verification.
Need expert guidance? Connect with a top Codersera professional today!