Metadata-Version: 2.4
Name: fotonet
Version: 1.2
Summary: Lightweight NMS-free object detection with a familiar API.
Author: iMGE
License: Apache-2.0
Project-URL: Homepage, https://fotonet.studio
Project-URL: Documentation, https://fotonet.studio/docs
Project-URL: Source, https://github.com/iMGEai/fotonet
Keywords: object-detection,computer-vision,deep-learning,fotonet
Classifier: Development Status :: 5 - Production/Stable
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: tomli>=2.0; python_version < "3.11" and extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Dynamic: license-file

# fotonet


![Turkey](https://img.shields.io/badge/Made%20in-Turkey-E30A17) ![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white) ![PyTorch](https://img.shields.io/badge/PyTorch-EE4C2C?logo=pytorch&logoColor=white)

`fotonet` is an open-source, NMS-free object-detection library for Python covering local inference, video tracking, training, validation, and model export.

## Models

| Model | Generation | Parameters | Compute (`640 × 640`) | Status |
| --- | --- | --- | --- | --- |
| `fotonetn` | v1.1 (UltraDense) | 2.85M | 6.95 GFLOPs | Available |
| `fotonets` | v1.1 (UltraDense) | 11.49M | 27.43 GFLOPs | Architecture in package, weights coming soon |
| `fotonetm` | v1.1 (UltraDense) | 22.23M | 63.38 GFLOPs | Architecture in package, weights coming soon |
| `fotonetl` | v1.1 (UltraDense) | 70.32M | 161.51 GFLOPs | Architecture in package, weights coming soon |
| `fotonete` | v1 | 1.70M | 5.20 GFLOPs | Available |

`fotonetn` now loads weights retrained with the 1.2 trainer: 32.1 mAP50-95 on COCO val2017, up from 29.9, with the same model, size and speed. The first weights stay in the release as `fotonetn-ex.pt`. See [published weights](docs/model-zoo.md#published-weights) and [trainer 1.2](docs/training.md#trainer-12).

## Install

```bash
pip install fotonet
```

For a development checkout:

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

## Quick start

Load the released checkpoint and run inference from Python:

```python
from fotonet import Fotonet

model = Fotonet("fotonetn")
results = model.predict("image.jpg", conf=0.25, imgsz=640)

for detection in results[0].boxes:
    print(detection.cls, detection.conf, detection.xyxy)
```

For a BGR frame from OpenCV:

```python
frame = cv2.imread("image.jpg")
results = model.predict_bgr(frame, conf=0.25, imgsz=640)
```

## Train

Training uses a YAML dataset configuration and writes checkpoints to a local run directory:

```bash
fotonet train \
  model=fotonetn \
  data=path/to/data.yaml \
  epochs=100 \
  batch=16 \
  imgsz=640 \
  run_dir=runs/fotonetn
```

Resume an interrupted run:

```bash
fotonet train \
  model=fotonetn \
  data=path/to/data.yaml \
  resume=runs/fotonetn/fotonet_last.pt
```

Weights and training outputs are not stored in the Git repository.

## Export

```python
from fotonet import Fotonet

model = Fotonet("fotonetn")
output = model.export(
    format="onnx",
    path="exports/fotonetn.onnx",
    imgsz=640,
)
print(output["artifact"])
```

See the [export guide](docs/export.md) for ONNX, TensorRT, and TorchScript options.

## Documentation

- [Documentation portal](docs/index.md)
- [Installation](docs/installation.md)
- [Quick start](docs/quickstart.md)
- [Inference and results](docs/inference.md)
- [Training and resume](docs/training.md)
- [Google Colab & cloud training](docs/colab_training.md)
- [Models and runtime](docs/model-zoo.md)
- [Model configuration](docs/model-config.md)
- [Export](docs/export.md)
- [Transform API](docs/transform-api.md)
- [Security](docs/security.md)
- [Contributing](docs/contributing.md)

## License

Apache License 2.0. See [LICENSE](LICENSE).
