Skip to content

Commit e6daa3b

Browse files
add copilot instructions
1 parent ed85e9e commit e6daa3b

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

AGENTS.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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.

tests/AGENTS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
applyTo: "tests/**.py"
3+
---
4+
- Tests will be run via pytest
5+
- Keep tests short and focused, with a clear contract
6+
- You can find data for testing in src/deepforest/data. Prefer to use existing files with utilities.get_data over generating data at test time.
7+
- Do not use print statements in tests, document failure with assertions
8+
- Use fixtures for repeated code sections, with appropriate scoping
9+
- Run models instead of mocking them. Use existing fixtures if suitable and set config options to be more efficient if necessary (such as fast_dev_run, low numbers of epochs)
10+
- Tests should check for behaviour, not duplicate logic from the library
11+
- Avoid excessive testing for initialization

0 commit comments

Comments
 (0)