Metadata-Version: 2.4
Name: fotonet
Version: 0.3.1a0
Summary: Lightweight NMS-free object detection with a familliar API.
Author: FOTO-NET contributors
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/hazegreleases/fotonet
Project-URL: Documentation, https://github.com/hazegreleases/fotonet#readme
Project-URL: Source, https://github.com/hazegreleases/fotonet
Keywords: object-detection,computer-vision,deep-learning,fotonet
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.1
Requires-Dist: torchvision>=0.16
Requires-Dist: numpy>=1.23
Requires-Dist: pillow>=9.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: pycocotools>=2.0.7
Requires-Dist: opencv-python>=4.7
Requires-Dist: matplotlib>=3.6
Requires-Dist: scipy>=1.10
Requires-Dist: tqdm>=4.64
Provides-Extra: metrics
Provides-Extra: export
Requires-Dist: onnx>=1.14; extra == "export"
Requires-Dist: onnxruntime>=1.16; extra == "export"
Requires-Dist: onnxsim>=0.4.36; extra == "export"
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Dynamic: license-file

![FOTO-NET alpha banner](https://raw.githubusercontent.com/hazegreleases/boringstuffreally/main/Alpha%20banner.png)

# FOTO-NET

FOTO-NET is a lightweight NMS-free object detector with a compact Python API and an application-friendly transform layer for working with detection boxes.

This is an alpha release. The architecture, training and validation contracts are implemented, but no evaluated pretrained weights are bundled and no public AP claim is made yet.

## What It Is

FOTO-NET focuses on practical object detection:

- compact model scales
- NMS-free one-to-one inference
- optional one-to-many training supervision
- small-object friendly P2 variants
- direct Python results objects
- transform helpers for crops, anchors, pixel movement, containment, and box manipulation
- export paths for ONNX, TorchScript, TensorRT, and CoreML where dependencies are available

## Alpha Status

The package is suitable for experimentation, integration testing, and training your own checkpoint. ONNX and TorchScript have automated parity checks; TensorRT/CoreML require their platform toolchains. Treat any named scale such as `fotonetn` as an untrained architecture until you load your own trusted checkpoint.

## Install

```bash
pip install fotonet
```

### Or

```bash
git clone https://github.com/hazegreleases/fotonet.git
cd fotonet
python -m pip install -e ".[dev]"
```

## Quick Start

```python
from fotonet import FOTONET

model = FOTONET("my_checkpoint.pt")
results = model.predict("image.jpg", conf=0.25)
result = results[0]  # predict() consistently returns list[Results] for images

for box in result.boxes:
    print(box.cls, box.conf, box.xyxy)
```

CLI:

```bash
fotonet predict model=my_checkpoint.pt source=image.jpg conf=0.25 save=true
```

## Transform API

```python
from fotonet import AnchorPoint

box = result.boxes[0]
crop = (
    box.transform
    .setAnchor(AnchorPoint.CENTER)
    .pixelExpand(40)
    .clamp()
    .crop(result.orig_img)
)
```

The raw box formats remain available through `box.xywh`, `box.xyxy`, and `result.boxes.numpy()`.

## Training

FOTO-NET expects YOLO-format labels:

```text
class_id x_center y_center width height
```

Train through Python:

```python
from fotonet import FOTONET

model = FOTONET("fotonetn")
summary = model.train(data="data.yaml", epochs=100, imgsz=640, batch=16)
```

Train through CLI:

```bash
fotonet train model=fotonetn data=data.yaml epochs=100 imgsz=640 batch=16
```

## Export

```python
from fotonet import FOTONET

model = FOTONET("my_checkpoint.pt")
artifact = model.export(format="onnx", path="exports/fotonet.onnx", imgsz=640)
print(artifact["artifact"], artifact["metadata"])
```

## Model Status

`fotonetn` is the current nano architecture. The following are architecture measurements, not accuracy claims: 2.24M parameters for the full train graph, 1.83M after stripping O2M heads for deployment, and 2.10 GMAC / 4.19 GFLOPs at 640×640 for the deploy graph. Reproducible AP belongs to a released checkpoint, dataset split, and evaluation command; none is published in this alpha.

## Documentation

- Installation: `docs/installation.md`
- Quick start: `docs/quickstart.md`
- Inference: `docs/inference.md`
- Training: `docs/training.md`
- Export: `docs/export.md`
- Model configuration: `docs/model-config.md`
- Transform API: `docs/transform-api.md`
- Model zoo: `docs/model-zoo.md`

## License

FOTO-NET is licensed under the Apache License, Version 2.0.
