YOLO-NAS
Detektor konvolusional yang backbone dan neck-nya dihasilkan oleh pencarian arsitektur Deci.AI, dibuat dari block RepVGG yang menyadari kuantisasi. Bobotnya milik Deci.AI, berlisensi hanya untuk penggunaan nonkomersial, dan LibreYOLO tidak menerbitkan satu pun.
- Task
- detection, pose, oriented boxes
- Ukuran
- s, m, l at 640 px
- Instalasi
pip install libreyolo- Tier dukungan
- Inti, sejak v1.1.0. Detektor inti yang dapat dilatih: fitur menyusul tier unggulan dalam gelombang rilis yang sama.
- Lisensi
- Kode Apache-2.0, bobot Deci.AI proprietary, non-commercial. Penggunaan komersial
Instalasi
YOLO-NAS tidak memerlukan komponen tambahan selain paket dasar.
pip install libreyoloPrediksi
Nama checkpoint yang belum tersedia di disk diambil dari CDN publik Deci, bukan organisasi LibreYOLO, yang tidak meng-host bobot ini. Sebelum transfer dimulai, library mencetak ketentuan lisensi Deci satu kali per proses, dan sebelum berkas unduhan dibuka, SHA-256-nya diperiksa terhadap nilai yang ditetapkan. Izin yang diberikan ketentuan tersebut dijelaskan dalam lisensi.
from libreyolo import LibreYOLO, SAMPLE_IMAGE # Nama yang belum tersedia di disk diambil dari CDN Deci. Pengunduhan# mencetak ketentuan lisensi Deci terlebih dahulu; mengambil berkas berarti menerimanya.model = LibreYOLO("LibreYOLONASs.pt")result = model(SAMPLE_IMAGE, save=True) for box in result.boxes: print(box.cls, box.conf, box.xyxy)libreyolo predict model=LibreYOLONASs.pt save=True \ source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpgfrom libreyolo import LibreYOLO, SAMPLE_IMAGE # Sufiks -pose memilih head pose dan kumpulan bobotnya sendiri.model = LibreYOLO("LibreYOLONASs-pose.pt")result = model(SAMPLE_IMAGE) print(result.keypoints.xy)Objek Results yang dikembalikan sama dengan yang dikembalikan setiap family, jadi mengganti
detektor hanya memerlukan perubahan satu baris. conf menetapkan ambang batas confidence
dan iou menetapkan ambang NMS. Lihat prediksi untuk sumber, streaming,
dan penanganan hasil.
Task kotak berorientasi mengembalikan result.obb. Graf OBB yang dipublikasikan memakai kanvas 1024 piksel dan kumpulan 18 kelas yang tercatat.
Varian
Deteksi dan pose memakai arsitektur yang sama di bawah head berbeda, serta menerima argumen yang sama. Ukuran pada tabel di bawah adalah ukuran deteksi; pose diterbitkan pada ukuran tersebut dan satu ukuran lebih kecil. Head pose memprediksi kumpulan keypoint COCO.
| Checkpoint | Input (piksel) | mAP 50-95 | Parameter (juta) |
|---|---|---|---|
| LibreYOLONASl | 640 | 56.3 | 66.98 |
| LibreYOLONASm | 640 | 55.4 | 51.18 |
| LibreYOLONASs | 640 | 51.8 | 19.05 |
COCO val2017, 500 images. Diukur oleh perangkat benchmark LibreYOLO dan dipublikasikan di Vision Analysis, tempat latensi pada berbagai hardware dan runtime dibandingkan serta rekaman lengkap setiap pengujian tersedia.
Pelatihan
from libreyolo import LibreYOLO model = LibreYOLO("LibreYOLONASs.pt")model.train(data="my-dataset.yaml", epochs=100, imgsz=640, batch=16)libreyolo train model=LibreYOLONASs.pt data=my-dataset.yaml \ epochs=100 imgsz=640 batch=16from libreyolo import LibreYOLONAS # Tidak ada checkpoint Deci yang disentuh: model dimulai dari bobot acak,# sehingga hasil proses hanya diturunkan dari data Anda.model = LibreYOLONAS(None, size="s")model.train(data="my-dataset.yaml", imgsz=640, batch=16)epochs, lr0, dan amp ditentukan per task jika dihilangkan, sehingga proses pose
dimulai dengan default berbeda dari proses deteksi. Optimizer memakai AdamW secara default.
Jumlah kelas berasal dari YAML dataset dan head dibangun ulang agar sesuai sebelum epoch
pertama; pada head pose, jumlah keypoint ditangani dengan cara yang sama, sehingga checkpoint
pose COCO dapat di-fine-tune ke skeleton berukuran berbeda.
Fine-tuning dimulai dari bobot Deci, yang dicakup oleh lisensi Deci. Pelatihan dari model yang diinisialisasi secara acak sama sekali tidak melibatkan checkpoint Deci, dan itulah snippet ketiga di atas.
Lihat pelatihan untuk dataset, augmentasi, multi-GPU, dan logger.
Deteksi memakai amp=True dengan amp_dtype="float16" secara default; pelatihan kotak berorientasi tetap memakai amp=False. Head OBB mendukung pelatihan, prediksi, dan validasi, memakai augmentasi pembalikan/HSV, serta memilih checkpoint dengan metrics/mAP50-95(OBB). load_detect_weights_for_obb() menginisialisasinya dari bobot deteksi.
Validasi
val() mengembalikan dictionary dengan key metrics/ yang mencakup presisi, recall,
mAP 50, dan mAP 50-95, yang diukur terhadap dataset apa pun dalam format yang digunakan
untuk pelatihan.
from libreyolo import LibreYOLO model = LibreYOLO("LibreYOLONASs.pt")metrics = model.val(data="my-dataset.yaml") print(metrics["metrics/mAP50-95"])print(metrics["metrics/mAP50"])libreyolo val model=LibreYOLONASs.pt data=my-dataset.yaml# YAML COCO bawaan menyertakan skrip unduhan tertanam, sehingga# memerlukan izin eksplisit kecuali dataset sudah tersedia secara lokal.libreyolo val model=LibreYOLONASl.pt data=coco.yaml imgsz=640 \ allow_download_scripts=TrueEkspor
| Task | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | ncnn | TFLite | CoreML | Core AI |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Detection | Detection to ONNX: didukung | Detection to TorchScript: didukung | Detection to ExecuTorch: didukung | Detection to TensorRT: didukung | Detection to OpenVINO: didukung | Detection to Paddle: didukung | Detection to MNN: didukung | Detection to RKNN: didukung | Detection to ncnn: didukung | Detection to TFLite: didukung | Detection to CoreML: tidak didukung | Detection to Core AI: didukung |
| Pose | Pose to ONNX: didukung | Pose to TorchScript: didukung | Pose to ExecuTorch: didukung | Pose to TensorRT: didukung | Pose to OpenVINO: didukung | Pose to Paddle: didukung | Pose to MNN: tidak didukung | Pose to RKNN: tidak didukung | Pose to ncnn: didukung | Pose to TFLite: tidak didukung | Pose to CoreML: tidak didukung | Pose to Core AI: tidak didukung |
| Oriented boxes | Oriented boxes to ONNX: didukung | Oriented boxes to TorchScript: didukung | Oriented boxes to ExecuTorch: didukung | Oriented boxes to TensorRT: didukung | Oriented boxes to OpenVINO: didukung | Oriented boxes to Paddle: tidak didukung | Oriented boxes to MNN: tidak didukung | Oriented boxes to RKNN: tidak didukung | Oriented boxes to ncnn: didukung | Oriented boxes to TFLite: tidak didukung | Oriented boxes to CoreML: tidak didukung | Oriented boxes to Core AI: tidak didukung |
Artefak hasil ekspor dimuat kembali melalui LibreYOLO() berdasarkan sufiks berkasnya,
sehingga berkas .onnx atau .engine berperilaku seperti checkpoint dan mengembalikan
Results yang sama. Menjalankan graph pada runtime mandiri tanpa memasang LibreYOLO juga
didukung, tetapi prapemrosesan dan pascapemrosesannya harus ditulis sendiri. Setiap format
memasang komponen tambahan berbeda dan menerima beberapa argumen sendiri. Keduanya dijelaskan
pada halaman format tersebut.
Ekspor merupakan salinan lain dari bobot yang sama dalam container berbeda. Mengekspor checkpoint Deci tidak mengubah asal bobot maupun lisensi yang mencakupnya.
from libreyolo import LibreYOLO model = LibreYOLO("LibreYOLONASs.pt")model.export(format="onnx", imgsz=640)libreyolo export model=LibreYOLONASs.pt format=onnx imgsz=640from libreyolo import LibreYOLO, SAMPLE_IMAGE # Factory merutekan berdasarkan sufiks berkas, sehingga artefak hasil ekspor# dimuat seperti checkpoint lain dan mengembalikan objek Results yang sama.model = LibreYOLO("LibreYOLONASs.onnx")result = model(SAMPLE_IMAGE) print(result.boxes.xyxy)Input dan output ONNX
LibreYOLONAS detect
| Tensor | images float32 [batch, 3, height, width] |
|---|---|
| Warna | RGB |
| Penskalaan | piksel / 255 |
| Normalisasi | tidak ada |
| Ubah ukuran | custom, Pillow bilinear |
Cara mereproduksi resize bilinear Pillow
LibreYOLO mengubah ukuran dengan filter BILINEAR milik Pillow (Image.resize). Ini bukan OpenCV INTER_LINEAR maupun INTER_AREA: saat memperkecil, Pillow memperlebar filter sebesar faktor pengecilan, dan resize OpenCV mengubah deteksi serta menggeser kotak beberapa piksel. Untuk mereproduksinya tanpa Pillow, ubah ukuran satu sumbu, bulatkan ke 8 bit, lalu ubah ukuran sumbu lainnya dan bulatkan lagi. Per sumbu, misalkan s = in_size / out_size dan f = max(s, 1). Piksel keluaran i berpusat di c = (i + 0.5) * s dan membaca piksel sumber j dari int(c - f + 0.5) sampai int(c + f + 0.5) - 1, dibatasi pada gambar, masing-masing dengan bobot max(0, 1 - |j + 0.5 - c| / f), dibagi jumlah bobot. Pillow bekerja dengan fixed point dan memilih urutan sumbu dari bentuk gambar, sehingga bobot float dapat berbeda satu level pada beberapa piksel. Hal itu tidak mengubah hasil pada pemeriksaan kami.
Square input only. Export rejects a non-square imgsz, and height equals width, 640 by default.
The image is not scaled to fill the canvas. The longest side goes to R = min(636, height, width), so 636 at 640 x 640.
Scale by r = min(R / h, R / w) and resize to (round(w * r), round(h * r)). The rounding is Python round, so an exact .5 goes to the even neighbor.
Paste the resized image onto a canvas filled with 114 at left = (width - new_w) // 2 and top = (height - new_h) // 2.
On the test image, cv2.resize with INTER_LINEAR loses two of the eight detections, and INTER_AREA moves boxes by up to 1.4 px.
Divide by 255 after the resize. There is no mean or std normalization.
Detection, ekspor default
| Output | Bentuk | Arti |
|---|---|---|
pred_logits | [batch, anchors, 4] | Boxes, despite the name. x1, y1, x2, y2 in input-canvas pixels. anchors is the cell count over strides 8, 16 and 32, 8400 at 640 x 640. |
pred_boxes | [batch, anchors, nc] | Class scores, despite the name. Sigmoid already applied. 80 classes for the COCO checkpoints. |
Pascapemrosesan
- The output names are swapped relative to their content. Read boxes from pred_logits and scores from pred_boxes, or tell them apart by the last dimension (4 for boxes).
- Take the best class per anchor: score = max over classes, class = argmax. One anchor yields at most one detection.
- Keep anchors whose score is strictly above the confidence threshold (0.25 by default).
- Keep the 1000 highest scoring candidates.
- Map boxes back to the original image: subtract left from x and top from y, divide by r, clip to the image. Drop boxes left with zero width or height.
- Run NMS per class with IoU 0.45 and keep at most 300 detections.
- nms=True is not available for this family: export raises NotImplementedError.
LibreYOLONAS pose
| Tensor | images float32 [batch, 3, height, width] |
|---|---|
| Warna | BGR |
| Penskalaan | piksel / 255 |
| Normalisasi | tidak ada |
| Ubah ukuran | custom, Pillow bilinear |
Cara mereproduksi resize bilinear Pillow
LibreYOLO mengubah ukuran dengan filter BILINEAR milik Pillow (Image.resize). Ini bukan OpenCV INTER_LINEAR maupun INTER_AREA: saat memperkecil, Pillow memperlebar filter sebesar faktor pengecilan, dan resize OpenCV mengubah deteksi serta menggeser kotak beberapa piksel. Untuk mereproduksinya tanpa Pillow, ubah ukuran satu sumbu, bulatkan ke 8 bit, lalu ubah ukuran sumbu lainnya dan bulatkan lagi. Per sumbu, misalkan s = in_size / out_size dan f = max(s, 1). Piksel keluaran i berpusat di c = (i + 0.5) * s dan membaca piksel sumber j dari int(c - f + 0.5) sampai int(c + f + 0.5) - 1, dibatasi pada gambar, masing-masing dengan bobot max(0, 1 - |j + 0.5 - c| / f), dibagi jumlah bobot. Pillow bekerja dengan fixed point dan memilih urutan sumbu dari bentuk gambar, sehingga bobot float dapat berbeda satu level pada beberapa piksel. Hal itu tidak mengubah hasil pada pemeriksaan kami.
Square input only. Export rejects a non-square imgsz, and height equals width, 640 by default.
Channels are BGR, unlike detection. Pad value and position also differ from detection.
The longest side goes to R = min(640, height, width), so it fills the canvas.
Scale by r = min(R / h, R / w) and resize to (round(w * r), round(h * r)). The rounding is Python round, so an exact .5 goes to the even neighbor.
Paste the resized image in the top-left corner of a canvas filled with 127. All padding is on the bottom and the right.
On the test image, cv2.resize with INTER_LINEAR or INTER_AREA moves boxes by up to 5 px and keypoints by more than 10 px.
Divide by 255 after the resize. There is no mean or std normalization.
Pose, ekspor default
| Output | Bentuk | Arti |
|---|---|---|
boxes | [batch, anchors, 4] | Person boxes as x1, y1, x2, y2 in input-canvas pixels. anchors is the cell count over strides 8, 16 and 32, 8400 at 640 x 640. |
scores | [batch, anchors, nc] | Class scores, sigmoid already applied. nc is 1 (person) for the COCO pose checkpoints. |
keypoints_xy | [batch, anchors, num_keypoints, 2] | Keypoint x, y in input-canvas pixels. num_keypoints is 17 (COCO order) for the COCO pose checkpoints. |
keypoints_conf | [batch, anchors, num_keypoints] | Per-keypoint visibility score, sigmoid already applied. |
Pascapemrosesan
- Take the best class per anchor: score = max over classes, class = argmax. With one class this is just the person score.
- Keep anchors whose score is at or above the confidence threshold (0.25 by default). This is >=, not > as in detection.
- Keep the 1000 highest scoring candidates.
- Map boxes and keypoints back to the original image: divide x and y by r. The image sits in the top-left corner, so there is no pad offset to subtract.
- Clip boxes to the image and drop boxes left with zero width or height. Keypoints are not clipped and can fall outside the image.
- Run NMS per class with IoU 0.45 and keep at most 300 detections. Keep each survivor's keypoints as (x, y, keypoints_conf).
- nms=True is not available for this family: export raises NotImplementedError.
LibreYOLONAS obb
| Tensor | images float32 [batch, 3, height, width] |
|---|---|
| Warna | BGR |
| Penskalaan | piksel / 255 |
| Normalisasi | tidak ada |
| Ubah ukuran | custom, bilinear |
Square input only. Export rejects a non-square imgsz, and height equals width, 1024 by default.
Channels are BGR, unlike detection. The resize filter and the pad position also differ from detection.
The longest side goes to R = min(1024, height, width), so it fills the canvas.
Scale by r = min(R / h, R / w) and resize to (round(w * r), round(h * r)). The rounding is Python round, so an exact .5 goes to the even neighbor.
The resize is cv2.resize with INTER_LINEAR, not Pillow as in detection and pose. It is skipped when the image already has that size. On the test image, Pillow's filter here changes the detection count.
Paste the resized image in the top-left corner of a canvas filled with 114. All padding is on the bottom and the right.
Divide by 255 after the resize. There is no mean or std normalization.
Oriented boxes, ekspor default
| Output | Bentuk | Arti |
|---|---|---|
boxes | [batch, anchors, 5] | Rotated boxes as cx, cy, w, h, angle. cx, cy, w and h are in input-canvas pixels. The angle is in radians. The graph computes it as (sigmoid(logit) - 0.25) x pi, so it lies between -pi/4 and 3pi/4 and is not wrapped yet. The w side points along (cos angle, sin angle) in image coordinates, y down. anchors is the cell count over strides 8, 16 and 32, 21504 at 1024 x 1024. |
scores | [batch, anchors, nc] | Class scores, sigmoid already applied. 18 classes (DOTA 2.0) for the published checkpoints. |
Pascapemrosesan
- Take the best class per anchor: score = max over classes, class = argmax. One anchor yields at most one detection.
- Keep anchors whose score is at or above the confidence threshold (0.25 by default). This is >=, not > as in detection.
- Keep the 1000 highest scoring candidates.
- Map boxes back to the original image: divide cx, cy, w and h by r. The image sits in the top-left corner, so there is no pad offset, and the angle does not change.
- Clip cx to 0 to the image width and cy to 0 to the image height. w and h are not clipped. Drop boxes with w or h at or below 0.
- Put the long side first: if h > w, swap w and h and add pi/2 to the angle. Then wrap the angle to [-pi/2, pi/2) with angle = ((angle + pi/2) mod pi) - pi/2.
- Run greedy NMS per class on exact rotated-box IoU (polygon intersection area over union, for example cv2.rotatedRectangleIntersection) with IoU 0.45, and keep at most 300 detections. LibreYOLO does not use upstream's matrix soft-NMS.
- LibreYOLO also reports an axis-aligned box per detection. With ex = abs(cos angle) * w / 2 + abs(sin angle) * h / 2 and ey = abs(sin angle) * w / 2 + abs(cos angle) * h / 2, it is cx - ex, cy - ey, cx + ex, cy + ey, clipped to the image.
- nms=True is not available for this family: export raises NotImplementedError.
Untuk memeriksa implementasi Anda sendiri, jalankan file yang sama lewat LibreYOLO: LibreYOLO("model.onnx").predict("image.jpg") mengembalikan hasil acuan. Diverifikasi dengan LibreYOLO 1.7.0.
Checkpoint
Tidak ada yang dapat dicantumkan. Lisensi Deci melarang distribusi ulang, sehingga organisasi
LibreYOLO tidak menerbitkan bobot YOLO-NAS dan unduhan diselesaikan di tempat lain: nama
berbentuk LibreYOLONAS<size>.pt, LibreYOLONAS<size>-pose.pt untuk pose, atau
LibreYOLONAS<size>-obb.pt (s, m, l) untuk kotak berorientasi, dipetakan ke objek yang
sesuai pada CDN publik Deci.
Hanya checkpoint dengan SHA-256 yang ditetapkan library yang dapat diambil dengan cara itu.
Semua yang lain gagal dalam kondisi tertutup, bukan membuka pickle pihak ketiga yang belum
diverifikasi, dan harus diunduh secara manual lalu diteruskan sebagai path. Berkas yang sudah
ada di disk dimuat dari path-nya tanpa pengunduhan dan tanpa pemeriksaan checksum. Ini termasuk
berkas .pth Deci dengan nama aslinya, yang dikenali loader.
Lisensi
Periksa lisensi di repositori Hugging Face untuk bobot tertentu yang diunduh. Setiap checkpoint di organisasi LibreYOLO memiliki lisensi, dan lisensinya tidak selalu sama dalam satu family. Repositori tersebut adalah sumber resmi. Ringkasan di bawah menjelaskan ketentuan yang berlaku saat halaman ini terakhir diverifikasi.
Ini adalah deskripsi lisensi yang terlibat, bukan nasihat hukum. Jika jawabannya penting secara komersial, baca sendiri lisensinya dan mintalah nasihat dari penasihat hukum Anda.
- Karya asli
- YOLO-NAS, Deci.AI
- Lisensi upstream
- Deci.AI proprietary, non-commercial
- Sumber upstream
- github.com/Deci-AI/super-gradients
- Kode LibreYOLO
- MIT
- Bobot
- Deci.AI proprietary, non-commercial, didistribusikan oleh penulisnya. LibreYOLO tidak menghosting atau mencerminkannya.
- Interpretasi
- Two licenses apply here and they are not the same. The SuperGradients source this port follows is Apache-2.0 and LibreYOLO's own implementation is MIT, so nothing restricts the architecture or the training code. Deci's published checkpoints are a different matter: the YOLO-NAS license grants a revocable, non-transferable right to use them and nothing more. It forbids redistribution and sublicensing, forbids offering them as a managed or remote service, restricts modification and reverse engineering, and rules out commercial use, including any model running in a production environment, unless you hold a separate agreement with Deci. LibreYOLO therefore does not mirror them, and prints those terms once before the download starts. Weights trained from a randomly initialized model on your own data derive from no Deci checkpoint.
LibreYOLO tidak meng-host atau mencerminkan bobot ini: tidak ada apa pun untuk family ini dalam organisasi Hugging Face LibreYOLO. Setiap pengunduhan otomatis menuju CDN publik Deci, mencetak ketentuan Deci satu kali per proses sebelum dimulai, dan diperiksa terhadap SHA-256 yang ditetapkan sebelum berkas dibuka.
Pelatihan dari model yang diinisialisasi secara acak adalah alternatifnya. Arsitektur berlisensi Apache-2.0 di upstream dan MIT di sini, sehingga model yang dilatih dengan cara tersebut pada data sendiri tidak diturunkan dari checkpoint Deci.
Sitasi
YOLO-NAS dirilis tanpa makalah. Entri di bawah adalah yang diminta penulisnya dan mencakup SuperGradients, library tempat model ini dirilis.
@misc{supergradients,
doi = {10.5281/ZENODO.7789328},
url = {https://zenodo.org/record/7789328},
author = {Aharon, Shay and {Louis-Dupont} and {Ofri Masad} and Yurkova, Kate and {Lotem Fridman} and {Lkdci} and Khvedchenya, Eugene and Rubin, Ran and Bagrov, Natan and Tymchenko, Borys and Keren, Tomer and Zhilko, Alexander and {Eran-Deci}},
title = {Super-Gradients},
publisher = {GitHub},
journal = {GitHub repository},
year = {2021},
}Disalin dari blok sitasi penulis di github.com/Deci-AI/super-gradients#citing.