Flor commited on
Commit
209e601
·
verified ·
1 Parent(s): b0262a9

card: update from fastforks 24802779

Browse files
Files changed (1) hide show
  1. README.md +59 -15
README.md CHANGED
@@ -28,6 +28,11 @@ Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex di
28
 
29
  | variant | weights (author link) | SHA-256 | weights licence | commercial use |
30
  |---|---|---|---|---|
 
 
 
 
 
31
  | `dfine-l-coco@1` | [dfine-large-coco.safetensors](https://huggingface.co/ustc-community/dfine-large-coco/resolve/aa8f8211545e4cff5adf52ea512f9ac74a9824ec/model.safetensors) | `4e9d77ba937a` | Apache-2.0 | yes |
32
  | `dfine-m-coco@1` | [dfine-medium-coco.safetensors](https://huggingface.co/ustc-community/dfine-medium-coco/resolve/4ab9f5e466432f4fcf9a9a023da6aa5ecc9c9829/model.safetensors) | `5a53154fb87a` | Apache-2.0 | yes |
33
  | `dfine-n-coco@1` | [dfine-nano-coco.safetensors](https://huggingface.co/ustc-community/dfine-nano-coco/resolve/066438d3d8f0da137a37b38fdf3368fd4afceced/model.safetensors) | `19e06bdc873d` | Apache-2.0 | yes |
@@ -36,7 +41,7 @@ Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex di
36
 
37
  ## Licence
38
 
39
- Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Files: `LICENSE`.
40
 
41
  Training data: COCO 2017 (train, instance annotations), ImageNet-1k (ILSVRC 2012 classification) (COCO 2017 train; the HGNetV2 backbones start from ImageNet-1k pretraining).
42
 
@@ -45,7 +50,7 @@ Licence evidence: <https://github.com/Peterande/D-FINE/blob/956d1709314c2c6a4df6
45
  ## Input size
46
 
47
  any H x W >= 32, padded to a multiple of 32
48
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `dfine-l-coco` 3000x4000 (0.5 GiB peak allocated, 0.7 reserved); `dfine-m-coco` 3000x4000 (0.5 GiB peak allocated, 0.6 reserved); `dfine-n-coco` 3000x4000 (0.5 GiB peak allocated, 0.6 reserved); `dfine-s-coco` 3000x4000 (0.5 GiB peak allocated, 0.6 reserved); `dfine-x-coco` 3000x4000 (0.6 GiB peak allocated, 0.7 reserved)
49
 
50
  ## Speed and memory
51
 
@@ -53,16 +58,26 @@ Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `dfine-l-coco` 3000x4000 (0.5
53
 
54
  | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
55
  | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
56
- | `dfine-l-coco` | 37.1 | 44.9 | 16.2 | 8.70 | 4.3x | 1.9x | 278 / 350 | 152 / 172 | 179 / 300 |
57
- | `dfine-m-coco` | 30.8 | 38.2 | 13.5 | 5.97 | 5.2x | 2.3x | 209 / 256 | 126 / 142 | 156 / 252 |
58
- | `dfine-n-coco` | 24.3 | 29.1 | 10.3 | 2.72 | 8.9x | 3.8x | 92 / 126 | 88 / 116 | 124 / 202 |
59
- | `dfine-s-coco` | 25.7 | 31.9 | 11.1 | 4.04 | 6.4x | 2.7x | 152 / 184 | 105 / 128 | 138 / 212 |
60
- | `dfine-x-coco` | 44.9 | 54.6 | 18.5 | 14.1 | 3.2x | 1.3x | 476 / 536 | 227 / 258 | 237 / 364 |
 
 
 
 
 
61
 
62
  ### Startup and first call
63
 
64
  | model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
65
  | --- | --- | --- | --- | --- | --- | --- |
 
 
 
 
 
66
  | `dfine-l-coco` | 3.68 | 1.09 | 1.46 | 1.41 | 0.67 | 0.47 |
67
  | `dfine-m-coco` | 3.63 | 1.04 | 1.20 | 1.55 | 0.69 | 0.56 |
68
  | `dfine-n-coco` | 5.24 | 1.25 | 1.21 | 4.07 | 0.85 | 0.62 |
@@ -71,16 +86,44 @@ Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `dfine-l-coco` 3000x4000 (0.5
71
 
72
  ### torch.compile and TensorRT
73
 
74
- | model | input | portable ms | compile ms | compile s (cold) | TensorRT fp16 ms | ONNX + build s | kernels ms | peak MiB (alloc / reserved): portable | compile | TensorRT (device) |
75
- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
76
- | `dfine-n-coco` | 800x1344 | 10.3 | 5.4 | 26.7 | 1.4 | 51 | 2.72 | 88 / 116 | 101 / 118 | 94 |
 
 
 
 
 
 
 
 
 
77
 
78
  Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
79
 
80
- Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (RTX 5060 Ti 16 GB, sm_120). Original = the authors' code at the precision of portable (fp16, or `(fp32)` where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
81
 
82
  ## Accuracy
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  ### Parity with the original code
85
 
86
  Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.2 and p99 <= 1.0 (absolute error of the output `boxes`).
@@ -88,22 +131,23 @@ Every variant is checked against reference outputs of the original code at its p
88
  ## Limitations
89
 
90
  - The original in the benchmarks and goldens is the Hugging Face transformers 5.19.0 port (DFineForObjectDetection, ustc-community weights) of the official D-FINE (Apache-2.0); the official repository code itself was not run.
 
91
 
92
  ## Usage
93
 
94
  ```python
95
  from fastforks import detection
96
 
97
- model = detection.load("dfine-l-coco") # mode="auto": the preferred backend from recorded measurements
98
  result = model("photo.jpg")
99
  result.boxes, result.scores, result.labels # [N, 4], [N], [N]
100
  result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
101
  ```
102
 
103
- Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `dfine-l-coco`, `dfine-m-coco`, `dfine-n-coco`, `dfine-s-coco`, `dfine-x-coco`.
104
 
105
  ## Kernels backend
106
 
107
- `detection.load("dfine-l-coco", mode="kernels")` runs our CUDA kernels (`cudnn_hacc`). It needs a prebuilt kernel for your GPU architecture (downloaded from <https://huggingface.co/fastforks/kernels> on first use) and a recent NVIDIA driver; if there is none it raises `BackendUnavailableError` with the reason and never falls back silently. `mode="auto"` picks `kernels` when it can run and logs the choice.
108
 
109
- <!-- staged from fastforks feccac41 (2026-11-06) -->
 
28
 
29
  | variant | weights (author link) | SHA-256 | weights licence | commercial use |
30
  |---|---|---|---|---|
31
+ | `deim-l-coco@1` | [deim_dfine_hgnetv2_l_coco.pth](https://drive.usercontent.google.com/download?id=1PIRf02XkrA2xAD3wEiKE2FaamZgSGTAr&export=download&confirm=t) | `a9ac1f9bf51a` | Apache-2.0 (assumed from code) | yes |
32
+ | `deim-m-coco@1` | [deim_dfine_hgnetv2_m_coco.pth](https://drive.usercontent.google.com/download?id=18Lj2a6UN6k_n_UzqnJyiaiLGpDzQQit8&export=download&confirm=t) | `2b6cd0582a4a` | Apache-2.0 (assumed from code) | yes |
33
+ | `deim-n-coco@1` | [deim_dfine_hgnetv2_n_coco.pth](https://drive.usercontent.google.com/download?id=1ZPEhiU9nhW4M5jLnYOFwTSLQC1Ugf62e&export=download&confirm=t) | `8536a97a57ba` | Apache-2.0 (assumed from code) | yes |
34
+ | `deim-s-coco@1` | [deim_dfine_hgnetv2_s_coco.pth](https://drive.usercontent.google.com/download?id=1tB8gVJNrfb6dhFvoHJECKOF5VpkthhfC&export=download&confirm=t) | `a089c9eb798f` | Apache-2.0 (assumed from code) | yes |
35
+ | `deim-x-coco@1` | [deim_dfine_hgnetv2_x_coco.pth](https://drive.usercontent.google.com/download?id=1dPtbgtGgq1Oa7k_LgH1GXPelg1IVeu0j&export=download&confirm=t) | `e729436f96d9` | Apache-2.0 (assumed from code) | yes |
36
  | `dfine-l-coco@1` | [dfine-large-coco.safetensors](https://huggingface.co/ustc-community/dfine-large-coco/resolve/aa8f8211545e4cff5adf52ea512f9ac74a9824ec/model.safetensors) | `4e9d77ba937a` | Apache-2.0 | yes |
37
  | `dfine-m-coco@1` | [dfine-medium-coco.safetensors](https://huggingface.co/ustc-community/dfine-medium-coco/resolve/4ab9f5e466432f4fcf9a9a023da6aa5ecc9c9829/model.safetensors) | `5a53154fb87a` | Apache-2.0 | yes |
38
  | `dfine-n-coco@1` | [dfine-nano-coco.safetensors](https://huggingface.co/ustc-community/dfine-nano-coco/resolve/066438d3d8f0da137a37b38fdf3368fd4afceced/model.safetensors) | `19e06bdc873d` | Apache-2.0 | yes |
 
41
 
42
  ## Licence
43
 
44
+ Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Files: `LICENSE`, `LICENSE-DEIM`.
45
 
46
  Training data: COCO 2017 (train, instance annotations), ImageNet-1k (ILSVRC 2012 classification) (COCO 2017 train; the HGNetV2 backbones start from ImageNet-1k pretraining).
47
 
 
50
  ## Input size
51
 
52
  any H x W >= 32, padded to a multiple of 32
53
+ Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `deim-l-coco` 3000x4000 (0.5 GiB peak allocated, 0.6 reserved); `deim-m-coco` 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); `deim-n-coco` 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); `deim-s-coco` 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); `deim-x-coco` 3000x4000 (0.6 GiB peak allocated, 0.6 reserved); `dfine-l-coco` 3000x4000 (0.5 GiB peak allocated, 0.7 reserved); `dfine-m-coco` 3000x4000 (0.5 GiB peak allocated, 0.6 reserved); `dfine-n-coco` 3000x4000 (0.5 GiB peak allocated, 0.6 reserved); `dfine-s-coco` 3000x4000 (0.5 GiB peak allocated, 0.6 reserved); `dfine-x-coco` 3000x4000 (0.6 GiB peak allocated, 0.7 reserved)
54
 
55
  ## Speed and memory
56
 
 
58
 
59
  | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
60
  | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
61
+ | `deim-l-coco` | – | 36.1 | 16.2 | 6.60 | 5.5x | 2.4x | 264 / 322 | 152 / 172 | 149 / 220 |
62
+ | `deim-m-coco` | – | 31.4 | 13.6 | 5.17 | 6.1x | 2.6x | 210 / 250 | 126 / 142 | 127 / 192 |
63
+ | `deim-n-coco` | – | 24.6 | 10.2 | 2.50 | 9.8x | 4.1x | 93 / 124 | 88 / 116 | 93 / 122 |
64
+ | `deim-s-coco` | – | 26.4 | 11.4 | 3.79 | 7.0x | 3.0x | 154 / 180 | 105 / 128 | 106 / 172 |
65
+ | `deim-x-coco` | – | 41.3 | 18.6 | 9.65 | 4.3x | 1.9x | 462 / 502 | 227 / 258 | 228 / 304 |
66
+ | `dfine-l-coco` | 37.1 | 44.9 | 16.2 | 6.64 | 5.6x | 2.4x | 278 / 350 | 152 / 172 | 149 / 220 |
67
+ | `dfine-m-coco` | 30.8 | 38.2 | 13.5 | 5.16 | 6.0x | 2.6x | 209 / 256 | 126 / 142 | 127 / 192 |
68
+ | `dfine-n-coco` | 24.3 | 29.1 | 10.3 | 2.52 | 9.7x | 4.1x | 92 / 126 | 88 / 116 | 93 / 122 |
69
+ | `dfine-s-coco` | 25.7 | 31.9 | 11.1 | 3.83 | 6.7x | 2.9x | 152 / 184 | 105 / 128 | 106 / 172 |
70
+ | `dfine-x-coco` | 44.9 | 54.6 | 18.5 | 9.71 | 4.6x | 1.9x | 476 / 536 | 227 / 258 | 228 / 304 |
71
 
72
  ### Startup and first call
73
 
74
  | model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
75
  | --- | --- | --- | --- | --- | --- | --- |
76
+ | `deim-l-coco` | 2.34 | 1.57 | 1.36 | 0.52 | 0.69 | 0.48 |
77
+ | `deim-m-coco` | 2.24 | 1.31 | 1.31 | 0.58 | 0.72 | 0.55 |
78
+ | `deim-n-coco` | 2.39 | 1.61 | 1.25 | 0.62 | 1.35 | 0.58 |
79
+ | `deim-s-coco` | 2.08 | 1.05 | 1.54 | 0.53 | 0.71 | 0.57 |
80
+ | `deim-x-coco` | 2.63 | 1.57 | 1.52 | 0.48 | 0.65 | 0.44 |
81
  | `dfine-l-coco` | 3.68 | 1.09 | 1.46 | 1.41 | 0.67 | 0.47 |
82
  | `dfine-m-coco` | 3.63 | 1.04 | 1.20 | 1.55 | 0.69 | 0.56 |
83
  | `dfine-n-coco` | 5.24 | 1.25 | 1.21 | 4.07 | 0.85 | 0.62 |
 
86
 
87
  ### torch.compile and TensorRT
88
 
89
+ | model | input | time: portable | compile | TensorRT fp16 | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
90
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
91
+ | `deim-l-coco` | 800x1344 | 16.2 ms | 7.99 ms | 3.39 ms | 6.60 ms | 49.8 s | 58.1 s | 152 / 172 | 175 / 198 | 149 / 220 | 229 / 266 |
92
+ | `deim-m-coco` | 800x1344 | 13.6 ms | 6.73 ms | 2.54 ms | 5.17 ms | 39.1 s | 58.2 s | 126 / 142 | 149 / 166 | 127 / 192 | 204 / 232 |
93
+ | `deim-n-coco` | 800x1344 | 10.2 ms | 5.44 ms | 1.01 ms | 2.50 ms | 28.0 s | 50.8 s | 88 / 116 | 101 / 118 | 93 / 122 | 113 / 128 |
94
+ | `deim-s-coco` | 800x1344 | 11.4 ms | 5.63 ms | 1.68 ms | 3.79 ms | 31.3 s | 57.5 s | 105 / 128 | 131 / 152 | 106 / 172 | 163 / 176 |
95
+ | `deim-x-coco` | 800x1344 | 18.6 ms | 11.0 ms | 5.10 ms | 9.65 ms | 48.8 s | 66.5 s | 227 / 258 | 245 / 284 | 228 / 304 | 352 / 394 |
96
+ | `dfine-l-coco` | 800x1344 | 16.2 ms | 7.91 ms | 3.19 ms | 6.64 ms | 45.7 s | 58.7 s | 152 / 172 | 175 / 198 | 149 / 220 | 219 / 256 |
97
+ | `dfine-m-coco` | 800x1344 | 13.5 ms | 6.79 ms | 2.49 ms | 5.16 ms | 36.4 s | 54.6 s | 126 / 142 | 149 / 166 | 127 / 192 | 204 / 232 |
98
+ | `dfine-n-coco` | 800x1344 | 10.3 ms | 5.43 ms | 0.942 ms | 2.52 ms | 26.7 s | 51.5 s | 88 / 116 | 101 / 118 | 93 / 122 | 113 / 128 |
99
+ | `dfine-s-coco` | 800x1344 | 11.1 ms | 5.63 ms | 1.65 ms | 3.83 ms | 31.2 s | 51.4 s | 105 / 128 | 131 / 152 | 106 / 172 | 147 / 160 |
100
+ | `dfine-x-coco` | 800x1344 | 18.5 ms | 11.0 ms | 5.03 ms | 9.71 ms | 47.7 s | 65.7 s | 227 / 258 | 245 / 284 | 228 / 304 | 342 / 374 |
101
 
102
  Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
103
 
104
+ Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or `(fp32)` where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
105
 
106
  ## Accuracy
107
 
108
+ ### On public datasets
109
+
110
+ pycocotools COCOeval of the top 100 detections per image. Original = the original code named under Details, same checkpoint and protocol.
111
+
112
+ | variant | dataset | original fp32 | original fp16 | portable | kernels | note |
113
+ |---|---|---|---|---|---|---|
114
+ | `dfine-n-coco` | COCO val2017, every 10th image, box mAP | 42.94 | 42.91 | 42.91 | 42.97 | |
115
+ | `dfine-s-coco` | COCO val2017, every 10th image, box mAP | 49.84 | 49.83 | 49.88 | 49.89 | |
116
+ | `dfine-m-coco` | COCO val2017, every 10th image, box mAP | 51.92 | 51.95 | 52.03 | 52.00 | |
117
+ | `dfine-l-coco` | COCO val2017, every 10th image, box mAP | 54.17 | 54.18 | 54.14 | 54.17 | |
118
+ | `dfine-x-coco` | COCO val2017, every 10th image, box mAP | 56.40 | 56.38 | 56.30 | 56.32 | |
119
+ | `deim-n-coco` | COCO val2017, every 10th image, box mAP | 44.38 | 44.37 | 44.40 | 44.38 | |
120
+ | `deim-s-coco` | COCO val2017, every 10th image, box mAP | 49.46 | 49.45 | 49.50 | 49.52 | |
121
+ | `deim-m-coco` | COCO val2017, every 10th image, box mAP | 52.38 | 52.43 | 52.43 | 52.43 | |
122
+ | `deim-l-coco` | COCO val2017, every 10th image, box mAP | 54.67 | 54.65 | 54.67 | 54.67 | |
123
+ | `deim-x-coco` | COCO val2017, every 10th image, box mAP | 56.87 | 56.91 | 56.86 | 56.90 | |
124
+
125
+ Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 675d6e93 / a981ff86, 2026-11-11 to 2026-11-12.
126
+
127
  ### Parity with the original code
128
 
129
  Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.2 and p99 <= 1.0 (absolute error of the output `boxes`).
 
131
  ## Limitations
132
 
133
  - The original in the benchmarks and goldens is the Hugging Face transformers 5.19.0 port (DFineForObjectDetection, ustc-community weights) of the official D-FINE (Apache-2.0); the official repository code itself was not run.
134
+ - deim-* variants: DEIM (Huang et al. 2025), the D-FINE network with SiLU decoder MLPs, trained with dense one-to-one matching; weights and the original in the benchmarks are from the official DEIM repository (@09d35d53).
135
 
136
  ## Usage
137
 
138
  ```python
139
  from fastforks import detection
140
 
141
+ model = detection.load("deim-l-coco") # mode="auto": the preferred backend from recorded measurements
142
  result = model("photo.jpg")
143
  result.boxes, result.scores, result.labels # [N, 4], [N], [N]
144
  result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
145
  ```
146
 
147
+ Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `deim-l-coco`, `deim-m-coco`, `deim-n-coco`, `deim-s-coco`, `deim-x-coco`, `dfine-l-coco`, `dfine-m-coco`, `dfine-n-coco`, `dfine-s-coco`, `dfine-x-coco`.
148
 
149
  ## Kernels backend
150
 
151
+ `detection.load("deim-l-coco", mode="kernels")` runs our CUDA kernels (`cudnn_hacc`, `fvm_conv`). It needs a prebuilt kernel for your GPU architecture (downloaded from <https://huggingface.co/fastforks/kernels> on first use) and a recent NVIDIA driver; if there is none it raises `BackendUnavailableError` with the reason and never falls back silently. `mode="auto"` picks `kernels` when it can run and logs the choice.
152
 
153
+ <!-- staged from fastforks 24802779 (2026-11-15) -->