Skip to main content

Modal app for training and inference of DeepForest models

Project description

PyPI version fury.io Documentation Status CI/CD pre-commit.ci status GitHub license

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

comparison 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

References

  1. 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.
  2. 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepforest_modal_app-0.2.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepforest_modal_app-0.2.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file deepforest_modal_app-0.2.0.tar.gz.

File metadata

  • Download URL: deepforest_modal_app-0.2.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for deepforest_modal_app-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5c4181fa2260c9d1521784ae7f07c1fb5598a6b29c53b8f22b3ff090b3dd0f3c
MD5 3ed8efb67c09fe416320a12b692da3e0
BLAKE2b-256 0eab4e472ce83693456ffdfb24f9bff04e11f00d872c5feaa3323967f6b48a96

See more details on using hashes here.

File details

Details for the file deepforest_modal_app-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: deepforest_modal_app-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for deepforest_modal_app-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9672109495af779c7edfc38e3b1f31fcc809480566d9a7611b57bdbfb2e1546e
MD5 3bbab50032770075152b73dc6ca4713e
BLAKE2b-256 346f23ec2b4c3666ed79e987d998243149d14dd3d8533cbeaf369059e58d7137

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page