DeepForest modal app
Modal app for serverless DeepForest [1] inference, training/fine tuning of tree crown detection and species classification models.
Features
Execute all your pipeline (preprocessing, training/fine tuning, inference, postprocessing...) within the same local script/notebook:
- When running DeepForest inference and training/fine tuning of tree detection models, this library will handle setting up a Modal ephemeral apps in a GPU-enabled environment, execute the deep learning parts there and you will then retrieve the results (e.g., a geopandas data frame) as a local variable within your notebook
- Optimized defaults for the serverless infrastructure (i.e., different training and inference GPUs) and matching settings (batch sizes, number of workers, image pre-loading...) to improve performance. TODO: support for multi-GPU training coming shortly.
- The required data (e.g., aerial imagery) and model checkpoints are uploaded to persistent Modal storage volumes
- Model checkpoints from HuggingFace Hub and PyTorch Hub are cached locally in a storage volume so uptime for ephemeral apps is minimal
Example annotations from the TreeAI Database (left), predictions with the DeepForest pre-trained tree crown model (center) and with the fine-tuned model (right).
Examples
The following example notebooks use the TreeAI Database [2] to illustrate the features of this setup:
getting-started.ipynb: example notebook showcasing inference and training/fine-tuning (with the default settings).advanced-customizations.ipynb: shows how to use data augmentations, logging, callbacks and sharing checkpoints in HuggingFace Hub.crop-model.ipynb: draft on multi-species classification using the DeepForest crop model.
Installation
This app requires geopandas in the local environment, which cannot be installed with pip. Until we have a working conda-forge recipe, the easiest solution is to first install geopandas using conda/mamba, e.g.:
conda install geopandas
and then install "deepforest-modal-app" using pip:
pip install deepforest-modal-app
Acknowledgements
- A big thank you to Charles Frye and Thomas Capelle for helping me to get started with Modal.
- This package was created with the martibosch/cookiecutter-geopy-package project template.
References
- Weinstein, B. G., Marconi, S., Aubry‐Kientz, M., Vincent, G., Senyondo, H., & White, E. P. (2020). DeepForest: A Python package for RGB deep learning tree crown delineation. Methods in Ecology and Evolution, 11(12), 1743-1751.
- Beloiu Schwenke, M., Xia, Z., Novoselova, I., Gessler, A., Kattenborn, T., Mosig, C., Puliti, S., Waser, L., Rehush, N., Cheng, Y., Xinliang, L., Griess, V. C., & Mokroš, M. (2025). TreeAI Global Initiative - Advancing tree species identification from aerial images with deep learning (TreeAI.V1.2) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.15351054
Metadata
Release files for deepforest-modal-app 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deepforest_modal_app-0.2.0.tar.gz | 20.4 kB | Without provenance | Details for deepforest_modal_app-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deepforest_modal_app-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for deepforest_modal_app-0.2.0-py3-none-any.whl |
Total release size: 41.6 kB
Release files / deepforest_modal_app-0.2.0.tar.gz
| Download URL | deepforest_modal_app-0.2.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c4181fa2260c9d1521784ae7f07c1fb5598a6b29c53b8f22b3ff090b3dd0f3c
|
|
BLAKE2b-256 checksum How to use checksums |
0eab4e472ce83693456ffdfb24f9bff04e11f00d872c5feaa3323967f6b48a96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / deepforest_modal_app-0.2.0-py3-none-any.whl
| Download URL | deepforest_modal_app-0.2.0-py3-none-any.whl |
|---|---|
| Size | 21.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9672109495af779c7edfc38e3b1f31fcc809480566d9a7611b57bdbfb2e1546e
|
|
BLAKE2b-256 checksum How to use checksums |
346f23ec2b4c3666ed79e987d998243149d14dd3d8533cbeaf369059e58d7137
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for deepforest-modal-app 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.