IMvision12 commited on
Commit
5705ca2
·
verified ·
1 Parent(s): 209a0ca

docs: Unsloth-style KerasFormers model card for rfdetr-base

Browse files
Files changed (1) hide show
  1. README.md +76 -7
README.md CHANGED
@@ -1,21 +1,90 @@
1
  ---
2
  pipeline_tag: object-detection
3
  license: apache-2.0
 
4
  library_name: kerasformers
5
  tags:
6
  - keras
7
  - kerasformers
8
- - rf_detr
9
- - tf
10
- - jax
 
11
  - pytorch
 
 
12
  ---
13
 
14
- # rfdetr-base (Keras 3)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- Pure-Keras 3 weights for [kerasformers](https://github.com/IMvision12/KerasFormers), mirrored from the GitHub release. Apache 2.0.
 
 
17
 
18
  ```python
19
- from kerasformers.models.rf_detr import RFDETRDetect
20
- model = RFDETRDetect.from_weights("rfdetr-base")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  pipeline_tag: object-detection
3
  license: apache-2.0
4
+ base_model: Roboflow/rf-detr-base
5
  library_name: kerasformers
6
  tags:
7
  - keras
8
  - kerasformers
9
+ - rf-detr
10
+ - detr
11
+ - object-detection
12
+ - arxiv:2511.09554
13
  - pytorch
14
+ - jax
15
+ - tf
16
  ---
17
 
18
+ ## ***See [our collection](https://huggingface.co/collections/kerasformers/rf-detr-6a69d4fc463069d0af85320b) for all versions of RF-DETR.***
19
+
20
+ # Run RF-DETR with Keras 3: JAX, PyTorch, or TensorFlow
21
+
22
+ [![GitHub](https://img.shields.io/badge/GitHub-KerasFormers-black?logo=github)](https://github.com/IMvision12/KerasFormers) [![Docs](https://img.shields.io/badge/Docs-RF--DETR-blue)](https://imvision12.github.io/KerasFormers/rf_detr/) [![Collection](https://img.shields.io/badge/HF-RF--DETR%20collection-yellow)](https://huggingface.co/collections/kerasformers/rf-detr-6a69d4fc463069d0af85320b)
23
+
24
+ # kerasformers/rfdetr-base
25
+
26
+ Paper: [RF-DETR: Neural Architecture Search for Real-Time Detection Transformers (arXiv:2511.09554)](https://arxiv.org/abs/2511.09554) · [HF Papers](https://huggingface.co/papers/2511.09554)
27
+
28
+ RF-DETR is Roboflow's real-time DETR, built on a windowed DINOv2 backbone with a lightweight deformable decoder. Configurations came out of a neural architecture search, so variants differ in resolution, patch size, window count, and decoder depth. Instance-segmentation checkpoints add a mask head.
29
+
30
+ For more details on the model, please go to Roboflow's original [model card](https://huggingface.co/Roboflow/rf-detr-base).
31
+
32
+ Pure-**Keras 3** conversion of [`Roboflow/rf-detr-base`](https://huggingface.co/Roboflow/rf-detr-base) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
33
 
34
+ This is an **object detection** checkpoint (`RFDETRDetect`): each query predicts a class and box.
35
+
36
+ ## ✨ Quick start
37
 
38
  ```python
39
+ import os
40
+ os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
41
+
42
+ from PIL import Image
43
+ from kerasformers.models.rf_detr import RFDETRDetect, RFDETRImageProcessor
44
+
45
+ model = RFDETRDetect.from_weights("kerasformers/rfdetr-base")
46
+ processor = RFDETRImageProcessor.from_weights("kerasformers/rfdetr-base")
47
+
48
+ image = Image.open("your_image.jpg").convert("RGB")
49
+ inputs = processor(image)
50
+ output = model(inputs["pixel_values"], training=False)
51
+ results = processor.post_process_object_detection(
52
+ output, threshold=0.5, target_sizes=[(image.height, image.width)]
53
+ )[0]
54
+ for score, name, box in zip(
55
+ results["scores"], results["label_names"], results["boxes"]
56
+ ):
57
+ print(f"{name}: {float(score):.3f} {box}")
58
  ```
59
+
60
+ Load any RF-DETR variant the same way with `from_weights("kerasformers/<variant>")` (use `RFDETRDetect` for this repo):
61
+
62
+ | Variant | Hub | Task |
63
+ |---|---|---|
64
+ | `rfdetr-nano` | [`kerasformers/rfdetr-nano`](https://huggingface.co/kerasformers/rfdetr-nano) | object detection |
65
+ | `rfdetr-small` | [`kerasformers/rfdetr-small`](https://huggingface.co/kerasformers/rfdetr-small) | object detection |
66
+ | `rfdetr-medium` | [`kerasformers/rfdetr-medium`](https://huggingface.co/kerasformers/rfdetr-medium) | object detection |
67
+ | `rfdetr-base` | [`kerasformers/rfdetr-base`](https://huggingface.co/kerasformers/rfdetr-base) | object detection |
68
+ | `rfdetr-large` | [`kerasformers/rfdetr-large`](https://huggingface.co/kerasformers/rfdetr-large) | object detection |
69
+ | `rfdetr-seg-preview` | [`kerasformers/rfdetr-seg-preview`](https://huggingface.co/kerasformers/rfdetr-seg-preview) | instance segmentation |
70
+ | `rfdetr-seg-nano` | [`kerasformers/rfdetr-seg-nano`](https://huggingface.co/kerasformers/rfdetr-seg-nano) | instance segmentation |
71
+ | `rfdetr-seg-small` | [`kerasformers/rfdetr-seg-small`](https://huggingface.co/kerasformers/rfdetr-seg-small) | instance segmentation |
72
+ | `rfdetr-seg-medium` | [`kerasformers/rfdetr-seg-medium`](https://huggingface.co/kerasformers/rfdetr-seg-medium) | instance segmentation |
73
+ | `rfdetr-seg-large` | [`kerasformers/rfdetr-seg-large`](https://huggingface.co/kerasformers/rfdetr-seg-large) | instance segmentation |
74
+ | `rfdetr-seg-xlarge` | [`kerasformers/rfdetr-seg-xlarge`](https://huggingface.co/kerasformers/rfdetr-seg-xlarge) | instance segmentation |
75
+ | `rfdetr-seg-xxlarge` | [`kerasformers/rfdetr-seg-xxlarge`](https://huggingface.co/kerasformers/rfdetr-seg-xxlarge) | instance segmentation |
76
+
77
+ ## Tips
78
+
79
+ - Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
80
+ - Prefer `RFDETRImageProcessor.from_weights(...)` so the processor resolution matches the variant (bare constructor defaults to base's 560).
81
+ - Detection: `RFDETRDetect` + `post_process_object_detection`.
82
+ - Segmentation: `RFDETRInstanceSegment` + `post_process_instance_segmentation`.
83
+ - See [RF-DETR docs](https://imvision12.github.io/KerasFormers/rf_detr/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
84
+ - Community / upstream safetensors still work via the `hf:` prefix, e.g. `RFDETRDetect.from_weights("hf:Roboflow/rf-detr-base")`.
85
+
86
+ ## Special Thanks
87
+
88
+ A huge thank you to the Roboflow RF-DETR authors for creating and releasing these models.
89
+
90
+ License: Apache 2.0.