TinyFormer

TinyFormer is a trainable transformer detector with a DINOv3 backbone.

Zadania
detection
Instalacja
pip install libreyolo
Poziom obsługi
Główny, od wersji v1.6.0. Główne trenowalne detektory: otrzymują funkcje po modelach flagowych w tej samej fali wydań.
Projekt źródłowy
TinyFormer, autorzy: TinyFormer authors, licencja: Apache-2.0; DINOv3 terms. Publikacja, kod źródłowy
Licencje
Kod: MIT, wagi: Apache-2.0; DINOv3 terms. Użycie komercyjne

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

ZadanieONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNncnnTFLiteCoreMLCore AI
DetectionDetection to ONNX: obsługiwaneDetection to TorchScript: obsługiwaneDetection to ExecuTorch: obsługiwaneDetection to TensorRT: obsługiwaneDetection to OpenVINO: obsługiwaneDetection to Paddle: brak obsługiDetection to MNN: brak obsługiDetection to RKNN: brak obsługiDetection to ncnn: brak obsługiDetection to TFLite: brak obsługiDetection to CoreML: brak obsługiDetection to Core AI: brak obsługi
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

Tensorimages float32 [batch, 3, height, width]
KolorRGB
Skalowaniepiksel / 255
Normalizacjaśrednia [0.485,0.456,0.406], odchylenie standardowe [0.229,0.224,0.225]
Zmiana rozmiarurozciągnij do szerokości x wysokości (bez wypełnienia, proporcje nie są zachowane), Pillow bilinear
Jak odtworzyć dwuliniowe skalowanie Pillow

LibreYOLO skaluje filtrem BILINEAR z Pillow (Image.resize). To nie jest OpenCV INTER_LINEAR ani INTER_AREA: przy zmniejszaniu Pillow poszerza filtr o współczynnik zmniejszenia, a skalowania OpenCV zmieniają detekcje i przesuwają ramki o kilka pikseli. Aby odtworzyć to bez Pillow, przeskaluj jedną oś, zaokrąglij do 8 bitów, potem przeskaluj drugą oś i zaokrąglij ponownie. Dla każdej osi niech s = in_size / out_size oraz f = max(s, 1). Piksel wyjściowy i ma środek c = (i + 0.5) * s i czyta piksele źródłowe j od int(c - f + 0.5) do int(c + f + 0.5) - 1, przycięte do obrazu, każdy z wagą max(0, 1 - |j + 0.5 - c| / f), podzieloną przez sumę wag. Pillow liczy w arytmetyce stałoprzecinkowej i wybiera kolejność osi na podstawie kształtu obrazu, więc wagi zmiennoprzecinkowe mogą się od niego różnić o jeden poziom na kilku pikselach. To nie zmienia wyników w naszych sprawdzeniach.

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, eksport domyślny
WyjścieKształtZnaczenie
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.

Przetwarzanie końcowe

  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.

Aby sprawdzić własną implementację, uruchom ten sam plik w LibreYOLO: LibreYOLO("model.onnx").predict("image.jpg") zwraca wyniki wzorcowe. Zweryfikowano w LibreYOLO 1.7.0.

Checkpoints

Licensing

Sprawdź licencję w repozytorium konkretnych pobieranych wag na Hugging Face. Każdy checkpoint w organizacji LibreYOLO ma licencję, która nie zawsze jest taka sama w całej rodzinie. To repozytorium jest źródłem rozstrzygającym, a poniższe podsumowanie opisuje stan z chwili ostatniej weryfikacji tej strony.

To opis obowiązujących licencji, a nie porada prawna. Jeśli odpowiedź ma znaczenie komercyjne, przeczytaj licencje i zasięgnij własnej porady prawnej.

Oryginalna praca
TinyFormer, TinyFormer authors
Licencja projektu źródłowego
Apache-2.0; DINOv3 terms
Kod źródłowy projektu
github.com/mmpmmpmmpjosh/TinyFormer
Kod LibreYOLO
MIT
Wagi
Apache-2.0; DINOv3 terms, ponownie opublikowane w huggingface.co/LibreYOLO
Interpretacja
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}

}

Skopiowano z bloku cytowania autorów w raw.githubusercontent.com/mmpmmpmmpjosh/TinyFormer/main/README.md.

Zweryfikowano z LibreYOLO v1.6.0. Tabele obsługi, checkpointy i wyniki benchmarków na tej stronie są generowane na podstawie wydanej biblioteki i opublikowanych wag, a nie wpisywane ręcznie.