Object detection has long relied on convolutional neural networks (CNNs) for their speed and efficiency, even as attention-based models have demonstrated superior modeling capabilities. However, YOLOv12 changes the game by integrating attention mechanisms without sacrificing speed, achieving a breakthrough in real-time detection. This latest iteration outperforms previous YOLO versions and real-time DETR-based models in both accuracy and efficiency. With impressive benchmarks, this model ensures top-tier performance for real-world applications like autonomous vehicles, surveillance, and robotics.
If you need a powerful yet efficient object detection model, installing YOLOv12 should be on your checklist. This guide will walk you through the installation process step by step, ensuring you can start leveraging its capabilities in no time.
Prerequisites
The minimum system requirements for this use case are:
- GPUs: RTX 4090 or RTX A6000
- Disk Space: 50 – 100 GB
- RAM: At least 8 GB.
- Nvidia Cuda installed.
Note: The prerequisites for this are highly variable across use cases. A high-end configuration could be used for a large-scale deployment.
Step-by-step process to install and run YOLO v12 for Object Detection
For the purpose of this tutorial, we’ll use a GPU-powered Virtual Machine by NodeShift since it provides high compute Virtual Machines at a very affordable cost on a scale that meets GDPR, SOC2, and ISO27001 requirements. Also, it offers an intuitive and user-friendly interface, making it easier for beginners to get started with Cloud deployments. However, feel free to use any cloud provider of your choice and follow the same steps for the rest of the tutorial.
Step 1: Setting up a NodeShift Account
Visit app.nodeshift.com and create an account by filling in basic details, or continue signing up with your Google/GitHub account.
If you already have an account, login straight to your dashboard.
Step 2: Create a GPU Node
After accessing your account, you should see a dashboard (see image), now:
- Navigate to the menu on the left side.
- Click on the GPU Nodes option.
- Click on Start to start creating your very first GPU node.
These GPU nodes are GPU-powered virtual machines by NodeShift. These nodes are highly customizable and let you control different environmental configurations for GPUs ranging from H100s to A100s, CPUs, RAM, and storage, according to your needs.
Step 3: Selecting configuration for GPU (model, region, storage)
- For this tutorial, we’ll be using the RTX 4090 GPU; however, you can choose any GPU of your choice based on your needs.
- Similarly, we’ll opt for 200GB storage by sliding the bar. You can also select the region where you want your GPU to reside from the available ones.
Step 4: Choose GPU Configuration and Authentication method
- After selecting your required configuration options, you’ll see the available VMs in your region and according to (or very close to) your configuration. In our case, we’ll choose a 1x RTX 4090 GPU node with 12 vCPUs/96GB RAM/200 GB SSD.
2. Next, you’ll need to select an authentication method. Two methods are available: Password and SSH Key. We recommend using SSH keys, as they are a more secure option. To create one, head over to our official documentation.
Step 5: Choose an Image
The final step would be to choose an image for the VM, which in our case is Nvidia Cuda, where we’ll deploy and run the inference of our model.
That’s it! You are now ready to deploy the node. Finalize the configuration summary, and if it looks good, click Create to deploy the node.
Step 6: Connect to active Compute Node using SSH
- As soon as you create the node, it will be deployed in a few seconds or a minute. Once deployed, you will see a status Running in green, meaning that our Compute node is ready to use!
- Once your GPU shows this status, navigate to the three dots on the right and click on Connect with SSH. This will open a new tab with a Jupyter Notebook session in which we can run our model.
Step 7: Set up the project environment with dependencies
1. Update the package source-list to latest versions.
apt update
Output:
2. Clone YOLO v12’s official repository.
git clone https://github.com/sunsmarterjie/yolov12.git
Output:
3. Move inside the project directory and create a virtual environment with Anaconda.
cd yolov12
conda create -n yolov12 python=3.11 -y
Output:
4. Activate the environment and download flash attention.
conda activate yolov12
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
Output:
5. Install other project dependencies as mentioned in requirements.txt
.
pip install -r requirements.txt
Output
6. Download packages in editable mode.
pip install -e .
Output:
7. Install libgl1
if it’s not already present in the system.
apt install -y libgl1-mesa-glx
Output:
8. Install the following python packages to avoid any errors due to these missing dependencies.
pip install packaging
pip uninstall -y ninja && pip install ninja
pip install flash_attn --no-build-isolation
Output:
Step 8: Start and run the model with Gradio
- Launch the
app.py
file to launch the Gradio interface.
python app.py
Output:
2. Forward and tunnel SSH port to access the website in your local browser, if you’re using a remote server (e.g. NodeShift).
Run the following command in your local terminal after replacing:
<YOUR_SERVER_PORT>
with the PORT allotted to your remote server (For the NodeShift server – you can find it in the deployed GPU details on the dashboard).
<PATH_TO_SSH_KEY>
with the path to the location where your SSH key is stored.
<YOUR_SERVER_IP>
with the IP address of your remote server.
ssh -L 7860:localhost:7860 -p <YOUR_SERVER_PORT> -i <PATH_TO_SSH_KEY> root@<YOUR_SERVER_IP>
Output:
3. Access the app at http://localhost:7860
.
It looks like this:
Step 9: Test the model
1. Object detection – People walking on the Street.
2. Object detection – Two people in a frame doing some gestures.
3. Object detection – Grocery Store
4. Object Detection – Video clip of a shop’s billing counter.
To watch the full output video generated by the model with detected objects along with the given input video, please refer to the link below:
https://drive.google.com/drive/folders/10puPBa1tvH281-b5jCQDIZXCJolEJPLt?usp=sharing
Conclusion
By installing YOLOv12 locally, you can quickly get started with object detection that blends the accuracy of attention mechanisms with the speed of CNN-based models. If you want to build autonomous systems, security applications, or AI-driven video analytics, YOLOv12 delivers unmatched efficiency and precision. However, deploying and scaling such models in production requires a robust cloud infrastructure. NodeShift makes this process seamless, by providing an environment for deploying and managing AI workloads. Its scalable yet affordable compute resources ensure that your YOLOv12-powered business applications run smoothly, from local development to real-world deployment.