Releases: Project-AgML/AgML
AgML 0.4.5
This feature adds a couple of new features as well as bugfixes for the existing API.
Main Changes
- You can now use image classification models (
agml.models.ClassificationModel
) as image regression models by passingregression = True
upon instantiation. This drops the finalargmax
computation and returns the softmax regression values. - Pass a custom set of RGB values to
agml.viz.set_colormap
to use a custom colormap. - A new preprocessing function has been added to
agml.models.preprocessing
:agml.models.preprocessing.imagenet_preprocess
, which prepares images for input to an ImageNet-backend model (image classification, semantic segmentation).
Bugfixes
- The
MeanAveragePrecision
metric has been fixed, and no longer throws errors for empty predictions (or for early-stage training results). - Custom object detection datasets can now be auto-loaded and classes automatically inferred without throwing an error.
AgML 0.4.4
This release introduces a number of updates and bugfixes.
Main Changes
agml.synthetic
- Helios compilation has now been optimized, meaning that canopy generation speed should be increased by 3 to 5 times.
- When using
HeliosOptions.camera.generate_positions()
, camera views are no longer angled by default.
agml.models
- The
agml.models.ClassificationModel
is now initialized withnum_classes
, rather than adataset
name. - For the
agml.models.SegmentationModel.predict()
method, a new argument,overlay
, has been added, which allows the resulting segmentation mask to be overlaid or displayed side-by-side.
agml.viz
- A new method has been added,
agml.viz.convert_figure_to_image()
, which converts the in-built Matplotlib figure when usingagml.viz
methods into an image array.
AgML 0.4.3
This release contains additional bugfixes for Helios installation and compilation.
AgML 0.4.2
This release fixes installation problems when installing Helios.
Bugfixes
- Helios will now auto-install when running any configuration or compilation methods, rather than throwing an installation error.
- The installation script which fetches Helios is now correctly included with the package.
Note: AgML v0.4.1 contains a partial fix of these errors, so please use this version instead. This GitHub release collapses v0.4.1 and v0.4.2 into a single release.
AgML 0.4.0
This is the first release in the AgML v0.4.x cycle, introducing the agml.synthetic
module backed by the Helios API (https://baileylab.ucdavis.edu/software/helios/) for generating synthetic agricultural data.
API Changes
agml.synthetic
- Introduction of the
agml.synthetic
module. - Generate data using the
agml.synthetic.HeliosDataGenerator
.- Customize generated data, including task, environment, and canopy parameters, using
agml.synthetic.HeliosOptions
. - Convert data between the Helios and AgML formats automatically upon generation.
- Customize generated data, including task, environment, and canopy parameters, using
- Customize the compilation of Helios using
agml.synthetic.recompile_helios
. - Get default parameters and information using
agml.synthetic.available_canopies()
andagml.synthetic.default_canopy_parameters()
.
agml.data
- Load Helios-generated synthetic datasets using
agml.data.AgMLDataLoader.helios()
.
agml.viz
- Added new inspection methods for synthetic data:
agml.viz.plot_synthetic_camera_positions
creates a 3D plot from camera position and lookat vectors, to understand the geometry of the environment.agml.viz.vizualize_all_views
plots all of the views for a specific generated canopy.
agml.backend
- Similar to the methods for public datasets and models, synthetic datasets can be generated to a specific path by using
agml.backend.set_synthetic_save_path()
, and retrieved usingagml.backend.synthetic_save_path()
.
AgML 0.3.0
This is the first release in AgML v0.3.x cycle, introducing the agml.models
module.
API Changes
agml.models
- Introduction of the
agml.models
module. To load the module, include animport agml.models
statement after the standardimport agml
. - Construct inference models for the following tasks:
- image classification:
agml.models.ClassificationModel
(using an EfficientNetB4 model) - semantic segmentation:
agml.models.SegmentationModel
(using a DeepLabV3 model) - object detection:
agml.models.DetectionModel
(using an EfficientDetD4 model)
- image classification:
- Use
model.predict
on an input data sample to get the prediction results, or usemodel.show_prediction
to visualize the prediction for semantic segmentation and object detection datasets. - Use
model.preprocess_input
to format inputs in the required format for each model. - Load a pretrained benchmark for an AgML public dataset using
model.load_benchmark
.- Currently available for semantic segmentation and object detection.
- Print information about the benchmark metric and training parameter using the
model.benchmark
property.
- Evaluate a model using standard metrics using
model.evaluate()
with anAgMLDataLoader
- Standard metric containers using the
agml.models.metrics
module: currently withAccuracy
for image classification andMeanAveragePrecision
for object detection. - Preprocessing pipelines using
agml.models.preprocessing
: currently withEfficientDetPreprocessor
for object detection models. - Standard loss functions with
agml.models.losses
: currently withDiceLoss
for semantic segmentation.
agml.data
- Load multiple datasets into a single
AgMLDataLoader
using the new Sequence API:agml.data.AgMLDataLoader([<d1>, <d2>])
. - Load custom datasets into an
AgMLDataLoader
usingagml.data.AgMLDataLoader.custom(<d>)
. - Merge two loaders into a single
AgMLDataLoader
usingagml.data.AgMLDataLoader.merge(<l1>, <l2>)
. - Copy the state of another
AgMLDataLoader
usingagml.data.AgMLDataLoader.copy_state(<d>)
. This copies the states of the internal managers, so the original loader will get the transforms, resizing, and training mode of the copied loader. - New Dataset Reduction Methods:
- Use
loader.take_random
to select a random number of data samples from the loader and return a new loader with this reduced number of samples. - Use
loader.take_class
on a multi-dataset object detectionAgMLDataLoader
to return a reduced loader containing all samples belonging to the specific class (or multiple classes). - Use
loader.take_dataset
on a multi-datasetAgMLDataLoader
to return one of the individual loaders in the collection.
- Use
- Preprocessing Changes:
- Select a custom method for image resizing using the
method
keyword argument inAgMLDataLoader.resize_images()
. - You can update whether the loader should be auto-shuffled internally through the
shuffle_data
property (set to True or False). - Semantic segmentation loaders now have an option
loader.mask_to_channel_basis
(the parallel ofloader.labels_to_one_hot
for image classification), which converts one-channel masks to multi-channel masks with each channel representing a binary mask for a class. - For multi-dataset object detection loaders, the
loader.generalize_class_detections
method generalizes all classes, thus resulting in the loader having only one-class (useful for localization-intensive tasks). - The
agml.data.convert_bbox_format
method now allows you to pass string formats, e.g.,pascal-voc
orefficientdet
: these get auto-expanded to the full bounding box format in the method itself.
- Select a custom method for image resizing using the
agml.backend
- Similar to the method for datasets, models can now be saved to a specific path using
agml.backend.set_model_save_path()
and this path can be retrieved usingagml.backend.model_save_path()
. - A new
agml.backend.experimental
module has been added for experimental features.- Currently, the first experimental feature is splitting already-split loaders, with
agml.backend.experimental.allow_nested_data_splitting()
.
- Currently, the first experimental feature is splitting already-split loaders, with
agml.viz
- New methods have been introduced which allow visualization of real and predicted samples:
- Visualize real and predicted bounding boxes with
agml.viz.visualize_real_and_predicted_boxes
. - Visualize an image with multiple sets of bounding boxes using
agml.viz.visualize_image_and_many_boxes
. - Visualize a real and predicted semantic segmentation mask with
agml.viz.visualize_image_mask_and_predicted
.
- Visualize real and predicted bounding boxes with
Behavior Changes
- The
AgMLDataLoader
now has a set of new properties (num_images
,num_classes
, etc). These are similar to the propertiesloader.info.num_images
,loader.images.num_classes
, etc., however, the properties directly on the loader reflect any changes applied to reduction methods.- For instance, if you call
loader.split()
, then the reducedloader.train_data
loader will have a reduced number ofloader.num_images
, whileloader.info.num_images
will continue to reflect the total number of images for the original dataset.
- For instance, if you call
- Dataset transforms are now tracked by their time of insertion; if you call
loader.transform()
twice, the transforms which are passed in the first call will be applied before those in the second call. - Any methods which use random operations (such as
loader.take_random
) now have an optionalrandom_state
keyword argument, which can be passed to control the random seed used for that method only. - All transformation methods now have an optional argument
add
which allows them to be disabled. - When converting an
AgMLDataLoader
into training mode, it now disables theauto
mode so that no inadvertent resizing is done unless the user explicitly requests it. - In all
agml.viz
methods, image arrays are auto-converted to 8-bit unsigned integer format before display. Additionally, theformat_image
method now takes an additional argumentmask
for preprocessing masks. - Array check methods now check for NumPy arrays and lists, before PyTorch tensors, before finally TensorFlow tensors: this prevents having to load in the full API for PyTorch/TensorFlow modules when unnecessary.
Other Bugfixes
- Bounding boxes for object datasets are now clipped at [0,
image_size
) on loading. - Exporting COCO datasets from a split
AgMLDataLoader
now returns the correct, reduced COCO JSON dictionary, rather than the entire dataset's COCO JSON. - Copying a loader or splitting it will now update all internal states; previously there was a chance the
TrainingManager
would have different resize/transform managers than the upper-levelDataManager
. - You can now download a list of datasets using
agml.data.download_public_dataset
. - When visualizing semantic segmentation masks with no class labels (e.g., a prediction with only zeros), now only the original image is displayed, rather than throwing an error.
- An error with namedtuples in local scopes which prevented
AgMLMetadata
from being serialized has been resolved.
AgML 0.2.9
This release fixes a small breaking change, updating the AWS download URL for datasets.
AgML 0.2.8
This release introduces three new semantic segmentation datasets:
peachpear_flower_segmentation
red_grapes_and_leaves_segmentation
white_grapes_and_leaves_segmentation
AgML 0.2.7
This release introduces two new object detection datasets: plant_doc_detection
and wheat_head_counting
.
In addition, a number of fixes have been made to existing datasets:
plant_doc_classification
: Class names have been updated.fruit_detection_worldwide
: Class indexing has been redone from 1 instead of 0 (to fit the object detection standard).apple_detection_usa
: There was an issue where multiple images had the same ID, this has been fixed so each image has a unique ID.rice_seedling_segmentation
: Removed the redundant background class and re-indexed from 1.
AgML 0.2.6
This is a bugfix-oriented release. The biggest new change is the removal of the cotton_seedling_counting
dataset.
Bugfixes
- Fixed an issue regarding splitting datasets using proportions (float values).
- Updated the number of images in
plant_seedlings_aarhus
to reflect the actual count. - Updated the error message displayed when accessing nonexistent metadata.