Object Detection
libreyolo
lw-detr
detr
File size: 2,281 Bytes
ba9c6f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---

license: apache-2.0
library_name: libreyolo
pipeline_tag: object-detection
tags:
  - object-detection
  - lw-detr
  - detr
datasets:
  - detection-datasets/coco
---


# LibreLWDETRx

LW-DETR-xlarge (118.0M params, 174.2 GFLOPs, 58.3 AP on COCO val2017), repackaged for [LibreYOLO](https://github.com/LibreYOLO/libreyolo).

LW-DETR pairs a plain-ViT encoder using interleaved window/global attention with
a multi-scale projector and a shallow deformable DETR decoder. It is NMS-free at
inference, and it is the architecture RF-DETR was later forked from.

```python

from libreyolo import LibreYOLO



model = LibreYOLO("LibreLWDETRx.pt")   # downloads from this repo

results = model.predict("image.jpg")

```

Inference-only in LibreYOLO: upstream's Group-DETR one-to-many training recipe
is not implemented, so `model.train(...)` raises. Input side must be a multiple
of 64 (the encoder tiles the patch grid into 4x4 windows); the default is 640.

## Source

Derived from [Atten4Vis/LW-DETR](https://github.com/Atten4Vis/LW-DETR)
(paper: [arXiv 2406.03459](https://arxiv.org/abs/2406.03459)), from the COCO
checkpoint `LWDETR_xlarge_60e_coco.pth` published at
[xbsu/LW-DETR](https://huggingface.co/xbsu/LW-DETR).
Copyright (c) 2024 Baidu. All Rights Reserved. Licensed under the Apache License 2.0.

Upstream's own lineage — Conditional DETR (Microsoft), DETR (Meta), Deformable
DETR (SenseTime), and ViTDet (Meta), all Apache-2.0 — is preserved in the source
headers of the LibreYOLO port.

## Modifications

Metadata wrap only. Learned parameters are unchanged, and no state-dict keys are
renamed. See `weights/convert_lwdetr_weights.py` in the
[LibreYOLO source repository](https://github.com/LibreYOLO/libreyolo).

The upstream release was saved with `--use_ema`, so these are the EMA weights
behind the published mAP. The 91-column classification head (one column per COCO
category id) is kept as-is; LibreYOLO maps it to the contiguous 80-class
interface at postprocess time.

Verified bit-exact against the official implementation:
`max_abs_diff == 0.0` on both `pred_logits` and `pred_boxes`.

## License

Apache License 2.0. See the [`LICENSE`](./LICENSE) and [`NOTICE`](./NOTICE)
files in this repository.