Update README.md
Browse files
README.md
CHANGED
|
@@ -12,3 +12,40 @@ tags:
|
|
| 12 |
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
|
| 13 |
- Code: https://github.com/cvg/Map-Det3D
|
| 14 |
- Paper: https://arxiv.org/abs/2608.12179
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
|
| 13 |
- Code: https://github.com/cvg/Map-Det3D
|
| 14 |
- Paper: https://arxiv.org/abs/2608.12179
|
| 15 |
+
|
| 16 |
+
Usage:
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
import torch
|
| 20 |
+
|
| 21 |
+
from mapdet3d.model.mapdet3d import MapDet3D
|
| 22 |
+
from mapdet3d.op.mapdet3d.head import RoI2Det
|
| 23 |
+
|
| 24 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 25 |
+
|
| 26 |
+
# TF32
|
| 27 |
+
torch.backends.cuda.matmul.allow_tf32 = True
|
| 28 |
+
torch.backends.cudnn.allow_tf32 = True
|
| 29 |
+
|
| 30 |
+
torch.set_float32_matmul_precision("highest")
|
| 31 |
+
|
| 32 |
+
# Init model
|
| 33 |
+
model = MapDet3D.from_pretrained("RoyYang0714/Map-Det3D").to(device)
|
| 34 |
+
|
| 35 |
+
# (Optional) Enable tracking
|
| 36 |
+
model.track_whole_scene = True
|
| 37 |
+
model.roi2det = RoI2Det(nms=True, score_threshold=0.25, iou_threshold=0.5)
|
| 38 |
+
|
| 39 |
+
# Inference
|
| 40 |
+
model.eval()
|
| 41 |
+
|
| 42 |
+
with torch.no_grad():
|
| 43 |
+
|
| 44 |
+
with torch.autocast("cuda", enabled=True, dtype=torch.bfloat16):
|
| 45 |
+
predictions: MapDet3DOut = model(
|
| 46 |
+
images=[image],
|
| 47 |
+
intrinsics=[intrinsics],
|
| 48 |
+
extrinsics=[extrinsics],
|
| 49 |
+
frame_ids=[frame_id],
|
| 50 |
+
)
|
| 51 |
+
```
|