TinyFormer

TinyFormer is a trainable transformer detector with a DINOv3 backbone.

Task
detection
Installa
pip install libreyolo
Livello di supporto
Principale, dalla v1.6.0. Rilevatori addestrabili principali: le funzionalità seguono i modelli di punta nella stessa ondata di release.
Origine
TinyFormer di TinyFormer authors, Apache-2.0; DINOv3 terms. Articolo, sorgente
Licenze
Codice MIT, pesi Apache-2.0; DINOv3 terms. Uso commerciale

Install

bash
pip install "libreyolo"

Predict

Python
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreTinyFormers.pt", device="cpu")result = model(SAMPLE_IMAGE)print(result)

Choose a published checkpoint below. The naming distinguishes the VisDrone variants and Objects365-to-COCO variants. Prediction requires a square imgsz; rectangular inputs raise an error.

Train

Training accepts a detection dataset YAML. Omitted epochs, batch, imgsz, lr0 and amp use the family recipe.

Dataset setup describes the required training data.

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreTinyFormers.pt", device="cpu")# coco8.yaml is a built-in 8-image detection dataset that downloads on first use.# Replace it with the path to your own detection dataset YAML.model.train(data="coco8.yaml", epochs=1, device="cpu", workers=0)

Validate

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreTinyFormers.pt", device="cpu")# coco8.yaml downloads on first use; pass your own detection dataset YAML instead.metrics = model.val(data="coco8.yaml", workers=0)print(metrics)

Use the dataset format for this task. Validation explains the dataset requirements and returned metrics.

Export

TaskONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNncnnTFLiteCoreMLCore AI
DetectionDetection to ONNX: supportatoDetection to TorchScript: supportatoDetection to ExecuTorch: supportatoDetection to TensorRT: supportatoDetection to OpenVINO: supportatoDetection to Paddle: non supportatoDetection to MNN: non supportatoDetection to RKNN: non supportatoDetection to ncnn: non supportatoDetection to TFLite: non supportatoDetection to CoreML: non supportatoDetection to Core AI: non supportato
Python
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreTinyFormers.pt", device="cpu")model.export(format="onnx")

Export setup lists format dependencies and loading exported artifacts.

ONNX inputs and outputs

Tensoreimages float32 [batch, 3, height, width]
ColoreRGB
Scalapixel / 255
Normalizzazionemedia [0.485,0.456,0.406], deviazione standard [0.229,0.224,0.225]
Ridimensionamentoallungare a larghezza x altezza (senza riempimento, il rapporto d'aspetto non viene mantenuto), Pillow bilinear
Come riprodurre il ridimensionamento bilineare di Pillow

LibreYOLO ridimensiona con il filtro BILINEAR di Pillow (Image.resize). Non è OpenCV INTER_LINEAR né INTER_AREA: in riduzione, Pillow allarga il filtro del fattore di riduzione, e i ridimensionamenti di OpenCV cambiano le rilevazioni e spostano i riquadri di diversi pixel. Per riprodurlo senza Pillow, ridimensiona un asse, arrotonda a 8 bit, poi ridimensiona l'altro asse e arrotonda di nuovo. Per ogni asse, siano s = in_size / out_size e f = max(s, 1). Il pixel di uscita i ha centro c = (i + 0.5) * s e legge i pixel sorgente j da int(c - f + 0.5) a int(c + f + 0.5) - 1, limitati all'immagine, ciascuno con peso max(0, 1 - |j + 0.5 - c| / f), diviso per la somma dei pesi. Pillow lavora in virgola fissa e sceglie l'ordine degli assi dalla forma dell'immagine, quindi i pesi in virgola mobile possono differire di un livello su pochi pixel. Questo non cambia i risultati nei nostri controlli.

Square input only. Export rejects a non-square imgsz, and height and width are 640 by default for every size. Another square imgsz must be a multiple of 32.

Batch size 1 only. The graph declares a dynamic batch axis, but batches of 2 or more fail in 1.7.0.

After the resize, divide by 255, then subtract the ImageNet mean and divide by the ImageNet std, per channel in RGB order.

Detection, esportazione predefinita
OutputFormaSignificato
pred_logits[batch, queries, nc]One logit per query and class. Sigmoid is not applied. queries is 300 for every size.
pred_boxes[batch, queries, 4]cx, cy, w, h of each query, normalized 0 to 1 of the input. The input is the whole image stretched, so these are also fractions of the original image.

Post-elaborazione

  1. Apply sigmoid to pred_logits.
  2. Flatten the [queries, nc] scores and take the top 300 (max_det, 300 by default). For flat index k, the query is k // nc and the class is k % nc. One query can yield several classes.
  3. Keep the pairs whose score is above the confidence threshold (0.25 by default).
  4. Convert the query's box to x1 = cx - w / 2, y1 = cy - h / 2, x2 = cx + w / 2, y2 = cy + h / 2. Multiply x by the original image width and y by the original image height.
  5. There is no NMS and the iou threshold is not used. TinyFormer predicts a set of boxes, and export with nms=True raises NotImplementedError.
  6. LibreYOLO does not clip these boxes, so an edge can sit slightly outside the image.

Per verificare la tua implementazione, passa lo stesso file a LibreYOLO: LibreYOLO("model.onnx").predict("image.jpg") restituisce i risultati di riferimento. Verificato con LibreYOLO 1.7.0.

Checkpoints

Oggi tutti i file elencati sopra sono presenti nell<link>organizzazione LibreYOLO</link> e vengono scaricati al primo utilizzo.

Licensing

Controlla la licenza nel repository Hugging Face degli specifici pesi che scarichi. Ogni checkpoint nell<link>organizzazione LibreYOLO</link> ne include una e non è sempre la stessa per tutta la famiglia. Quel repository è la fonte autorevole; il riepilogo seguente descrive le condizioni applicabili al momento dellultima verifica di questa pagina.

Questa è una descrizione delle licenze coinvolte, non una consulenza legale. Se la risposta è importante a fini commerciali, leggi personalmente le licenze e chiedi una consulenza indipendente.

Lavoro originale
TinyFormer, TinyFormer authors
Licenza upstream
Apache-2.0; DINOv3 terms
Codice LibreYOLO
MIT
Pesi
Apache-2.0; DINOv3 terms, ripubblicati su huggingface.co/LibreYOLO
Interpretazione
The detector uses Apache-2.0 source and a DINOv3 backbone with its own terms. Check the publisher declarations for the chosen checkpoint.

Citation

@article{hsieh2026tinyformer,

  title={TinyFormer: Preserving Tiny Objects in YOLO-DETR Hybrid Real-time Detectors},

  author={Hsieh, Jun-Wei and Kao, Meng-Yu and Kurniawan, Ghufron Wahyu and Peng, Kuan-Chuan},

  journal={arXiv preprint arXiv:2605.25046},

  year={2026}

}

Copiato dal blocco di citazione degli autori disponibile su raw.githubusercontent.com/mmpmmpmmpjosh/TinyFormer/main/README.md.

Verificato con LibreYOLO v1.6.0. Le tabelle di supporto, i checkpoint e i dati dei benchmark in questa pagina vengono generati dalla libreria rilasciata e dai pesi pubblicati, non scritti a mano.