The most important changes since 2.0.0:
- Replace Albumentations with Kornia - Migrated augmentations to Kornia (#1230)
- CLI restructure - Split CLI into sub-scripts for clearer organization
- Evaluation improvements - Refactored evaluation to support other geometries; migrated to torchmetrics
- Prediction and training API - Simplified evaluation and prediction to mirror training; standardized train, eval and predict to accept lists not batches
- Numpy 2.x support - Removed restriction to numpy<2.0
- CropModel enhancements - Added macro-precision metric and expand context pixels for BoundingBoxDataset
- Fix: Image color format when saving; now uses PIL instead of OpenCV to preserve colors
- Fix: MultiImage dataset using same indices during batch processing
- Fix:
evaluate_boxesTypeError when ground truth has non-default index - Fix: DETR box coordinates
- Fix: Support empty annotations in image callback
- Fix: Detach losses when logging to avoid graph retention
- Fix: CropModel docstring to match
__init__signature
- Config: Added
log_rootconfig option; improved config handling; serialize dictconfig as plain data - read_file: Refactored for readability and to allow multiple image files; assume dataframe has root dir to simplify viz code
- Bounding boxes: Add validation checks for boxes outside image boundaries
- Compatibility: Block incompatible transformers versions; remove numpy<2.0 restriction
- CropModel: Add expand context pixels for BoundingBoxDataset via
cropmodel.expandconfig
- Switch from tmpdir to tmp_path in tests
- Add white-image model inference test; add regression test for HuggingFace model label_dict loading
- Codecov test target and threshold; disable build failures from patch coverage diffs
- New contributing guidelines and dev guidelines
The major innovations are:
- Migration from albumentations to kornia for data augmentations - Replaced albumentations with kornia
- Migrated most transformations to
korniaequivalents. See documentation for more information. albumentationsdependency is removed.- Most existing transformation types are supported with minimal changes to configuration needed.
ZoomBlurandRandomPadToaugmentations added
- Albumentations'
DownScale(down + upscale) is no longer supported. Users can use twoResizesteps to mimic this, orRandomResizedCrop.
Removed Functions:
xml_to_annotations()- Useutilities.read_pascal_voc(path)or the generalutilities.read_file(path).boxes_to_shapefile()- Useimage_to_geo_coordinates().project_boxes()- Useimage_to_geo_coordinates().annotations_to_shapefile- Useimage_to_geo_coordinates().plot_points()- Useplot_resultsdraw_points()- Useplot_resultsplot_predictions()- Useplot_resultsdraw_predictions()- Useplot_resultsuse_release()- Useload_model('weecology/deepforest-tree')insteaduse_bird_release()- Useload_model('weecology/deepforest-bird')instead
Removed Parameters:
geometry_typeandsave_dirfromshapefile_to_annotations()num_classesandlabel_dictfromdeepforest()constructor - Use config file insteadaugmentparameter from all functions - Useaugmentationsparameter insteadraster_pathparameter from predict_tile() - Usepathparameter instead
Migration Guide:
- Augmentations: Update parameter names and use kornia transforms (see documentation)
- Replace
xml_to_annotations(xml_path)withread_pascal_voc(xml_path) - Replace
boxes_to_shapefile(df, root_dir)withimage_to_geo_coordinates(df, root_dir) - Replace
plot_points(image, points)withplot_results(results) - Replace
draw_points(image, points)withplot_results(results) - Replace
plot_predictions(image, df)withplot_results(results) - Replace
draw_predictions(image, df)withplot_results(results) - Replace
use_release()withload_model('weecology/deepforest-tree') - Replace
use_bird_release()withload_model('weecology/deepforest-bird') - Use config file or
config_argsinstead of constructor parameters - Use
augmentationsparameter instead ofaugmentparameter
Developer Workflow:
- Pre-commit workflow with Ruff, docformatter, and nbQA for automated code quality checks
- Editor integration recommendations (VS Code, PyCharm, Vim/Neovim)
- Comprehensive developer contributing guide
Infrastructure:
- Modernized pyproject.toml configuration with improved dependency management
- Better optional dependency handling (dev, docs)
Documentation:
- Enhanced Sphinx documentation with pydata theme
- Improved version switcher for release candidates
- ReadTheDocs integration with uv
Testing:
- Enhanced test coverage for edge cases
- Added comprehensive test suites for dataset handling, evaluation metrics, CLI functionality, model inference, and HuggingFace model loading
Model Structure:
- Enhanced configuration handling via config file system
- Better separation of concerns between training and prediction modules
- Consistent type hints in
BaseModeland model creation methods - Improved model validation with
check_model()method
Data Handling:
- Improved annotation reading with unified
read_file()method - Enhanced geometry type detection and conversion
- Better coordinate system handling (image ↔ geographic)
Installation & Packaging:
- Updated Python version requirement to 3.11+
- Removed conda support (package now only available via PyPI)
- Canonical PEP 440 versioning format implementation (e.g.,
2.0.0rc1)
Testing & Evaluation:
- Improved
evaluate_boxes()with better multi-class support - Enhanced class recall and precision calculations
- Better handling of empty predictions and ground truth
- Improved point recall evaluation for point annotations
Documentation:
- Enhanced installation instructions (pip/uv focused)
- Better examples and tutorials
- Updated migration guides for deprecated features
Internal / Developer Updates:
- Fixed publish pipeline issues
- No user-facing changes from 2.0.0rc1
Removed Functions:
xml_to_annotations()- Useutilities.read_pascal_voc(path)or the generalutilities.read_file(path).boxes_to_shapefile()- Useimage_to_geo_coordinates().project_boxes()- Useimage_to_geo_coordinates().annotations_to_shapefile- Useimage_to_geo_coordinates().plot_points()- Useplot_resultsdraw_points()- Useplot_resultsplot_predictions()- Useplot_resultsdraw_predictions()- Useplot_resultsuse_release()- Useload_model('weecology/deepforest-tree')insteaduse_bird_release()- Useload_model('weecology/deepforest-bird')instead
Removed Parameters:
geometry_typeandsave_dirfromshapefile_to_annotations()num_classesandlabel_dictfromdeepforest()constructor - Use config file insteadaugmentparameter from all functions - Useaugmentationsparameter insteadraster_pathparameter from predict_tile() - Usepathparameter instead
Migration Guide:
- Replace
xml_to_annotations(xml_path)withread_pascal_voc(xml_path) - Replace
boxes_to_shapefile(df, root_dir)withimage_to_geo_coordinates(df, root_dir) - Replace
plot_points(image, points)withplot_results(results) - Replace
draw_points(image, points)withplot_results(results) - Replace
plot_predictions(image, df)withplot_results(results) - Replace
draw_predictions(image, df)withplot_results(results) - Replace
use_release()withload_model('weecology/deepforest-tree') - Replace
use_bird_release()withload_model('weecology/deepforest-bird') - Use config file or
config_argsinstead of constructor parameters - Use
augmentationsparameter instead ofaugmentparameter
The major innovations are:
- Improve Tests on edge cases
Additional features and enhancements include:
- Documentation: Improved documentation workflow and version available
The major innovations are:
- Restructured package layout by moving code into
src/directory for better organization - Added batch prediction capabilities for improved processing of multiple images
- Implemented support for image dataframes to allow more flexible input formats
- Created
plot_annotationsmethod for better visualization of predictions - Added out-of-memory dataset sample for handling large datasets efficiently
Additional features and enhancements include:
- Enhancement: Reorganized package structure to follow modern Python packaging standards
- Enhancement: Enhanced test coverage for new features
- Enhancement: Improved code organization and maintainability
- Documentation: Added docformatter for consistent docstring formatting
- Documentation: Improved documentation clarity and organization
- Documentation: Added new contributor: Dingyi Fang
- Enhancement: Use GitHub Actions to publish the package.
The major innovations are:
- New model loading framework using HuggingFace. DeepForest models are now available on HuggingFace. The models can be loaded using
load_model()and used for inference. - An all-purpose
read_filemethod is introduced to read annotations from various formats including CSV, JSON, and Pascal VOC. - The
CropModelclass is introduced to classify detected objects using a trained classification model. Use when a multi-class DeepForest model is not sufficiently flexible, such as when new data sources are used for fine-grained classification and class imbalance. deepforest.visualize.plot_resultsis now the primary method for visualizing predictions. The function is more flexible and allows for customizing the plot using the supervision package.
Additional features and enhancements include:
-
New Feature: A
crop_rasterfunction is introduced to crop a raster image using a bounding box. -
New Feature: Added beta support for multiple annotation types including point, box, and polygon.
-
New Feature: Added support for learning rates scheduling using the
torch.optim.lr_schedulermodule. The learning rate scheduler can be specified in the configuration file. -
New Utility: Created
utilities.download_ArcGIS_RESTfunction to download tiles from the ArcGIS REST API (e.g., NAIP imagery). -
Enhancement: The training module better matches torchvision negative anchors format for empty frames.
-
Deprecation:
shapefile_to_annotationsindeepforest/utilities.pyis deprecated in favor of the more generalread_filemethod. -
Deprecation:
predictindeepforest/main.py. Thereturn_plotargument is deprecated and will be removed in version 2.0. Usevisualize.plot_resultsinstead. -
Deprecation:
predict_tileindeepforest/main.py. Deprecated argumentsreturn_plot,color, andthicknesswill be removed in version 2.0. -
Deprecation:
crop_functionindeepforest/preprocess.py. Thebase_dirargument is deprecated and will be removed in version 2.0. Usesave_dirinstead. -
Deprecation: The
deepforest.visualize.IoU_Callbackfor better alignment with the PyTorch Lightning API (see issue). -
Deprecation:
deepforest.main.use_releaseanddeepforest.main.use_bird_releaseare deprecated in favor of the new model loading framework, for example usingdeepforest.main.load_model("weecology/deepforest-bird").
- Enhancement:
split_rasternow allowsannotations_fileto beNone, enabling flexibility during data preprocessing.
- Deprecation: Removed
IoU_Callbackfor better alignment with the PyTorch Lightning API (see issue). - Refactor: Evaluation code now leverages the PyTorch Lightning evaluation loop for result calculation during training.
- Refactor: Simplified
image_callbacksby using predictions directly. No need to specify the root directory or CSV file, as the evaluation file is assumed.
- Enhancement: Added box coordinates to the evaluation results frame for better result tracking.
- Bug Fix: Fixed incorrect precision calculation in
class_recall.csvwhen multiple classes were present.
- Update:
project_boxesnow includes output options for bothpredict_tileandpredict_image. - New Feature: Introduced
annotations_to_shapefile, which reversesshapefile_to_annotationsfunctionality. Thanks to @sdtaylor for this contribution.
-
Enhancement: Empty frames are now allowed by passing annotations with 0's for all coordinates. Example format:
image_path, 0, 0, 0, 0, "Tree" -
New Feature: Introduced
check_releaseto reduce GitHub rate limit issues. When usinguse_release(), the local model will be used ifcheck_release = False.
- Enhancement: Improved default dtype for Windows users, thanks to @ElliotSalisbury for the contribution.
- Major Update: Transitioned from TensorFlow to a PyTorch backend, enhancing performance and flexibility.
- Optimization: Profiled dataset and evaluation code, significantly improving evaluation performance.
- Bug Fix: Resolved issues to allow learning rate monitoring and decay based on
val_classification_loss.