Scoprite PyTorch, il framework di machine learning flessibile e Python che alimenta innovazioni AI come Ultralytics YOLO. Costruite in modo più intelligente e veloce oggi stesso!
PyTorch is an open-source machine learning library primarily developed by Meta AI that has become a cornerstone for researchers and developers in the field of deep learning. Known for its flexibility and ease of use, it allows users to build and train complex neural networks using a dynamic computational graph. This feature, often referred to as "eager execution," enables code to be evaluated immediately, making debugging and prototyping significantly more intuitive compared to frameworks that rely on static graph definitions. It integrates seamlessly with the Python programming language, feeling like a natural extension of standard scientific computing tools.
At the heart of this framework are tensors, which are multi-dimensional arrays similar to those found in the NumPy documentation. However, unlike standard arrays, PyTorch tensors are designed to leverage GPU acceleration provided by NVIDIA CUDA. This hardware acceleration is critical for the massive parallel processing required to train modern artificial intelligence (AI) models efficiently.
The library supports a vast ecosystem of tools for computer vision (CV) and natural language processing. By providing a rich set of pre-built layers, optimizers, and loss functions, it simplifies the process of creating algorithms for tasks like image classification and sequence modeling.
La versatilità di questo framework ha portato alla sua adozione in diversi settori industriali per soluzioni di IA ad alto impatto:
Per comprendere meglio il suo ruolo, è utile distinguere PyTorch altri strumenti comuni nello stack AI:
L'intera famiglia Ultralytics , compresi l'innovativo YOLO26 e il diffuso YOLO11, è costruita in modo nativo su PyTorch. Questa base garantisce agli utenti di beneficiare della velocità, della stabilità e dell'ampio supporto della community del framework. Sia che si esegua il transfer learning su dati di addestramento personalizzati o che si esportino modelli per dispositivi edge, l' architettura sottostante si basa sui PyTorch e sui gradienti PyTorch .
Ultralytics di prossima uscita semplifica ulteriormente questa esperienza, fornendo un'interfaccia unificata per gestire l'approvvigionamento, la formazione e l'implementazione dei set di dati senza dover scrivere un codice boilerplate esteso.
L'esempio seguente mostra come verificare GPU ed eseguire l'inferenza utilizzando un YOLO , illustrando come il framework gestisce l'accelerazione hardware sotto il cofano:
import torch
from ultralytics import YOLO
# Check if CUDA (GPU) is available for PyTorch acceleration
device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"PyTorch is using device: {device}")
# Load a YOLO26n model (built on PyTorch)
model = YOLO("yolo26n.pt")
# Perform object detection on an image
# PyTorch handles tensor operations and moves data to the GPU automatically
results = model("https://ultralytics.com/images/bus.jpg", device=device)