Views
No views yet
pip install -U mlx-vlm1from pathlib import Path
2from PIL import Image
3from mlx_vlm.utils import load_model
4from mlx_vlm.models.rfdetr.processing_rfdetr import RFDETRProcessor
5from mlx_vlm.models.rfdetr.generate import RFDETRPredictor
6
7model = load_model(Path("mlx-community/rfdetr-base-fp32"))
8processor = RFDETRProcessor.from_pretrained("mlx-community/rfdetr-base-fp32")
9predictor = RFDETRPredictor(model, processor, score_threshold=0.3, nms_threshold=0.5)
10
11result = predictor.predict(Image.open("image.jpg"))
12for name, score, box in zip(result.class_names, result.scores, result.boxes):
13 print(f"{name}: {score:.2f} [{box[0]:.0f}, {box[1]:.0f}, {box[2]:.0f}, {box[3]:.0f}]")1# Image
2python -m mlx_vlm.models.rfdetr.generate --image photo.jpg --model mlx-community/rfdetr-base-fp32
3
4# Video
5python -m mlx_vlm.models.rfdetr.generate --video input.mp4 --model mlx-community/rfdetr-base-fp32
6
7# Realtime camera
8python -m mlx_vlm.models.rfdetr.generate --task realtime --model mlx-community/rfdetr-base-fp32| Architecture | DINOv2-small backbone + C2f projector + Deformable DETR decoder |
| Task | Object detection (COCO 80 classes) |
| Parameters | ~32M |
| Input resolution | 560x560 |
| Dtype | float32 |
| Inference (M4 Max) | ~32ms per image (~31 FPS) |