TinyFormer

TinyFormer is a trainable transformer detector with a DINOv3 backbone.

Tareas
detection
Instalación
pip install libreyolo
Nivel de compatibilidad
Núcleo, desde v1.6.0. Detectores entrenables del núcleo: las funciones siguen a los modelos emblemáticos en la misma oleada de versiones.
Proyecto original
TinyFormer de TinyFormer authors, Apache-2.0; DINOv3 terms. Artículo, fuente
Licencias
Código MIT, pesos Apache-2.0; DINOv3 terms. Uso comercial

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

TareaONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNncnnTFLiteCoreMLCore AI
DetectionDetection to ONNX: compatibleDetection to TorchScript: compatibleDetection to ExecuTorch: compatibleDetection to TensorRT: compatibleDetection to OpenVINO: compatibleDetection to Paddle: no compatibleDetection to MNN: no compatibleDetection to RKNN: no compatibleDetection to ncnn: no compatibleDetection to TFLite: no compatibleDetection to CoreML: no compatibleDetection to Core AI: no compatible
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]
ColorRGB
Escaladopíxel / 255
Normalizaciónmedia [0.485,0.456,0.406], desviación típica [0.229,0.224,0.225]
Redimensionadoestirar a ancho x alto (sin relleno, no se conserva la relación de aspecto), Pillow bilinear
Cómo reproducir el redimensionado bilineal de Pillow

LibreYOLO redimensiona con el filtro BILINEAR de Pillow (Image.resize). No es OpenCV INTER_LINEAR ni INTER_AREA: al reducir, Pillow ensancha el filtro según el factor de reducción, y los redimensionados de OpenCV cambian las detecciones y desplazan las cajas varios píxeles. Para reproducirlo sin Pillow, redimensiona un eje, redondea a 8 bits, luego redimensiona el otro eje y vuelve a redondear. Por eje, sea s = in_size / out_size y f = max(s, 1). El píxel de salida i tiene centro c = (i + 0.5) * s y lee los píxeles de origen j desde int(c - f + 0.5) hasta int(c + f + 0.5) - 1, recortados a la imagen, cada uno con peso max(0, 1 - |j + 0.5 - c| / f), dividido por la suma de los pesos. Pillow trabaja en coma fija y elige el orden de los ejes según la forma de la imagen, así que los pesos en coma flotante pueden diferir en un nivel en unos pocos píxeles. Eso no cambia los resultados en nuestras comprobaciones.

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, exportación por defecto
SalidaFormaSignificado
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.

Posprocesado

  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.

Para comprobar tu propia implementación, pasa el mismo archivo por LibreYOLO: LibreYOLO("model.onnx").predict("image.jpg") devuelve los resultados de referencia. Verificado con LibreYOLO 1.7.0.

Checkpoints

Licensing

Comprueba la licencia en el repositorio de Hugging Face de los pesos concretos que descargues. Cada checkpoint de la organización de LibreYOLO incluye una, y no siempre es la misma en toda una familia. Ese repositorio es la fuente autorizada; el resumen siguiente describe qué se aplicaba cuando se verificó esta página por última vez.

Esta es una descripción de las licencias implicadas, no asesoramiento legal. Si la respuesta es importante a nivel comercial, lee las licencias y busca tu propio asesoramiento.

Trabajo original
TinyFormer, TinyFormer authors
Licencia del proyecto original
Apache-2.0; DINOv3 terms
Fuente del proyecto original
github.com/mmpmmpmmpjosh/TinyFormer
Código de LibreYOLO
MIT
Pesos
Apache-2.0; DINOv3 terms, republicados en huggingface.co/LibreYOLO
Interpretación
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}

}

Copiado del bloque de cita de los autores en raw.githubusercontent.com/mmpmmpmmpjosh/TinyFormer/main/README.md.

Verificado con LibreYOLO v1.6.0. Las tablas de compatibilidad, los checkpoints y las cifras de rendimiento de esta página se generan a partir de la biblioteca publicada y los pesos publicados; no se escriben a mano.