# FCOS3D
FCOS3D predicts three-dimensional boxes from a single image.
Tasks: 3D detection. Install: pip install "libreyolo[hf]".
Verified against LibreYOLO v1.6.0.

## Install

```bash
pip install "libreyolo[hf]"
```

## Predict

**Python**

```python
from libreyolo import LibreFCOS3D, SAMPLE_IMAGE
from PIL import Image

model = LibreFCOS3D(device="cpu")
# Rough pinhole guess so the snippet runs. For real metric boxes, pass
# your camera's measured 3x3 matrix for the original image size.
w, h = Image.open(SAMPLE_IMAGE).size
f = float(max(w, h))
intrinsics = [[f, 0, w / 2], [0, f, h / 2], [0, 0, 1]]
result = model.predict(SAMPLE_IMAGE, intrinsics=intrinsics)
print(result.boxes3d)
```

FCOS3D runs natively on CPU or CUDA and requires original-image camera intrinsics. MPS is not supported. The default confidence is 0.05, rotated NMS IoU is 0.8 and `max_det` is 200.

`result.boxes3d` holds centers, dimensions and wxyz quaternions in camera coordinates, plus confidence, class and intrinsics. Plotting projects cuboids into the image. Training, validation, tracking and export are not supported. See [3D detection](/docs/tasks/3d-object-detection).

## Licensing

Check the license on the Hugging Face repository of the specific weights you download. That repository is authoritative and licenses are not always uniform across a family. This is a description of the licenses involved, not legal advice.

- Original work: FCOS3D, OpenMMLab
- Upstream license: Apache-2.0 code
- Upstream source: https://github.com/open-mmlab/mmdetection3d
- LibreYOLO code: MIT
- Weights: Apache-2.0 code, republished at https://huggingface.co/LibreYOLO
- Interpretation: The upstream repository declares Apache-2.0. A distinct per-artifact checkpoint license is not recorded in the library source.

## Citation

```bibtex
@inproceedings{wang2021fcos3d,
	title={{FCOS3D: Fully} Convolutional One-Stage Monocular 3D Object Detection},
	author={Wang, Tai and Zhu, Xinge and Pang, Jiangmiao and Lin, Dahua},
	booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV) Workshops},
	year={2021}
}
```

Copied from https://raw.githubusercontent.com/open-mmlab/mmdetection3d/main/configs/fcos3d/README.md
