RF-DETR-Base (DINOv2)
accurate skin lesion detection on ONNX
2 min readupdated
An object detection model based on the RF-DETR architecture with a DINOv2 backbone (powerful computer vision model), trained to analyze dermatoscopic images. It detects four classes of skin pathologies and lesions: acne, basal cell carcinoma (bcc), melanoma, and nevus. The model comes in a ready-to-use ONNX format (cross-platform model inference format) without heavy NMS (Non-Maximum Suppression, method for removing duplicate bounding boxes), making integration easier. The release targets medical computer science researchers, medical image analysis developers, and benchmark specialists.
Key features
- High accuracy: achieves an mAP@50 (mean average precision at a 50 percent intersection threshold) of 81.17% on complex dermatoscopic boundaries.
- DINOv2 backbone: uses powerful visual embeddings to accurately segment small and blurry structures.
- ONNX-ready: weights are compiled into a 108.71 MB file for fast execution on the CPU.
- Fixed resolution: operates with a static input size of 560x560 pixels.
What you can do
- Integrate the model into a local Python image processing pipeline using ONNX Runtime and NumPy.
- Conduct research benchmarks and analyze skin pathology detection accuracy on custom datasets.
- Build supporting tools for educational and research-oriented dermatoscopic image analysis systems.
Example
import numpy as np, onnxruntime as ort
from PIL import Image
sess = ort.InferenceSession("best.onnx", providers=["CPUExecutionProvider"])
img = Image.open("lesion.jpg").convert("RGB")
W, H = img.size
arr = np.asarray(img.resize((560, 560)), dtype=np.float32) / 255.0
arr = (arr - np.array([0.485, 0.456, 0.406], np.float32)) / np.array([0.229, 0.224, 0.225], np.float32)
inp = np.transpose(arr, (2, 0, 1))[None, ...]
dets, labels = sess.run(None, {"input": inp})
print(f"Детекции получены: {dets.shape}")
Read more
DetailsMetrics: mAP@50 81.17%, mAP@50-95 56.80%, precision 79.23%, recall 74.71%
Hardware and training: trained in 67.7 minutes on 1× NVIDIA H200 (peak VRAM 20.0 GB)
Inference: ~495.9 ms (2.02 FPS) on Intel Xeon @ 2.20GHz (4 threads, FP32)
Limitations: the model is intended strictly for research and benchmarking, and is not a medical diagnostic device










Comments