|
| 1 | +# Project Overview |
| 2 | + |
| 3 | +DeepForest is a Python library for object detection in aerial images, primarily trees, but also supporting models for livestock and other objects of interest. It uses pytorch throughout and the Lightning framework for model training, prediction and evaluation. |
| 4 | + |
| 5 | +Imagery is of a relatively high resolution and is generally not satellite data. |
| 6 | + |
| 7 | +## Setup |
| 8 | + |
| 9 | +- We use `uv` for package management |
| 10 | +- NEVER edit dependencies in pyproject.toml directly, ALWAYS use `uv add` |
| 11 | +- To set up, use `uv sync --all-extras --dev`. You can reference the CI workflow in .github |
| 12 | +- Use the `deepforest` command line interface with Hydra overrides for simple tests |
| 13 | + |
| 14 | +## Folder Structure |
| 15 | + |
| 16 | +- `/src`: Contains the source code for the DeepForest library |
| 17 | +- `/src/conf`: Contains configuration files in OmegaConf/Hydra format, and the schema.py |
| 18 | +- `/src/scripts`: Contains CLI interface(s) to DeepForest |
| 19 | +- `/tests`: Contains the unit tests; we use pytest |
| 20 | +- `/docs`: Contains documentation for the project, build using Sphinx and hosted on readthedocs. |
| 21 | + |
| 22 | +## Libraries |
| 23 | + |
| 24 | +- torch, torchvision, torchmetrics, transformers, pandas, numpy, scipy |
| 25 | +- pytorch lightning |
| 26 | +- visualization using matplotlib and supervision |
| 27 | + |
| 28 | +## Data formats |
| 29 | + |
| 30 | +- Annotations are usually provided in CSV with Pascal VOC convention for bounding box coordinates. For example: |
| 31 | + |
| 32 | +``` |
| 33 | +image_path,xmin,ymin,xmax,ymax,label |
| 34 | +OSBS_029.tif,203,67,227,90,Tree |
| 35 | +OSBS_029.tif,256,99,288,140,Tree |
| 36 | +OSBS_029.tif,166,253,225,304,Tree |
| 37 | +``` |
| 38 | + |
| 39 | +- Other input types are possible using utilities.read_file |
| 40 | +- Example CSV and shapefile inputs are in `/src/data` |
| 41 | + |
| 42 | +## Configuration |
| 43 | + |
| 44 | +- Use the configuration system to specify user-facing parameters instead of hardcoding/magic numbers in code |
| 45 | +- Make sure the schema is up to date with the config files |
| 46 | + |
| 47 | +## Coding standards |
| 48 | + |
| 49 | +- Simple and maintainable |
| 50 | +- Write docstrings and use type annotation |
| 51 | +- Limited comments, highlighting important details |
| 52 | +- Keep documentation in sync with code changes |
| 53 | +- We use ruff for linting with options set in pyproject.toml |
| 54 | +- Enforced by .pre-commit.yaml |
| 55 | +- Take advantage of implicit vectorization using pandas, numpy, etc. Avoid explicit loops if you can. |
0 commit comments