AgML
Provides access to public agricultural datasets for common agricultural deep learning tasks, with standard benchmarks and pretrained models, as well the ability to generate synthetic data and annotations.
https://github.com/project-agml/agml
Category: Consumption
Sub Category: Agriculture and Nutrition
Keywords
agriculture computer-vision dataset deep-learning image-classification object-detection pytorch semantic-segmentation synthetic-data
Keywords from Contributors
geocode virtualization
Last synced: about 2 hours ago
JSON representation
Repository metadata
AgML is a centralized framework for agricultural machine learning. AgML provides access to public agricultural datasets for common agricultural deep learning tasks, with standard benchmarks and pretrained models, as well the ability to generate synthetic data and annotations.
- Host: GitHub
- URL: https://github.com/project-agml/agml
- Owner: Project-AgML
- License: apache-2.0
- Created: 2021-10-29T13:44:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-22T00:44:51.000Z (9 days ago)
- Last Synced: 2025-04-25T14:08:08.637Z (5 days ago)
- Topics: agriculture, computer-vision, dataset, deep-learning, image-classification, object-detection, pytorch, semantic-segmentation, synthetic-data
- Language: Python
- Homepage: https://project-agml.github.io/AgML/
- Size: 212 MB
- Stars: 211
- Watchers: 14
- Forks: 32
- Open Issues: 11
- Releases: 27
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Authors: AUTHORS
README.md
AI Institute for Food Systems team and help lead AgML development? ðŠīððĐðžâðŧðĻðŧâðŧ
ðĻðŋâðŧðĐð―âðŧððŠī Want to join theWe're looking to hire a postdoc with both Python library development and ML experience. Send your resume and GitHub profile link to jmearles@ucdavis.edu!
Overview
AgML is a comprehensive library for agricultural machine learning. Currently, AgML provides
access to a wealth of public agricultural datasets for common agricultural deep learning tasks. In the future, AgML will provide ag-specific ML functionality related to data, training, and evaluation. Here's a conceptual diagram of the overall framework.
AgML supports both the TensorFlow and PyTorch machine learning frameworks.
Installation
To install the latest release of AgML, run the following command:
pip install agml
NOTE: Some features of AgML, such as synthetic data generation, require GUI applications. When running AgML through
Windows Subsystem for Linux (WSL), it may be necessary to configure your WSL environment to utilize these features. Please
follow the Microsoft documentation to install all
necessary prerequisites and update WSL. The latest version of WSL includes built-in support for running Linux GUI applications.
Quick Start
AgML is designed for easy usage of agricultural data in a variety of formats. You can start off by using the AgMLDataLoader
to
download and load a dataset into a container:
import agml
loader = agml.data.AgMLDataLoader('apple_flower_segmentation')
You can then use the in-built processing methods to get the loader ready for your training and evaluation pipelines. This includes, but
is not limited to, batching data, shuffling data, splitting data into training, validation, and test sets, and applying transforms.
import albumentations as A
# Batch the dataset into collections of 8 pieces of data:
loader.batch(8)
# Shuffle the data:
loader.shuffle()
# Apply transforms to the input images and output annotation masks:
loader.mask_to_channel_basis()
loader.transform(
transform = A.RandomContrast(),
dual_transform = A.Compose([A.RandomRotate90()])
)
# Split the data into train/val/test sets.
loader.split(train = 0.8, val = 0.1, test = 0.1)
The split datasets can be accessed using loader.train_data
, loader.val_data
, and loader.test_data
. Any further processing applied to the
main loader will be applied to the split datasets, until the split attributes are accessed, at which point you need to apply processing independently
to each of the loaders. You can also turn toggle processing on and off using the loader.eval()
, loader.reset_preprocessing()
, and loader.disable_preprocessing()
methods.
You can visualize data using the agml.viz
module, which supports multiple different types of visualization for different data types:
# Disable processing and batching for the test data:
test_ds = loader.test_data
test_ds.batch(None)
test_ds.reset_prepreprocessing()
# Visualize the image and mask side-by-side:
agml.viz.visualize_image_and_mask(test_ds[0])
# Visualize the mask overlaid onto the image:
agml.viz.visualize_overlaid_masks(test_ds[0])
AgML supports both the TensorFlow and PyTorch libraries as backends, and provides functionality to export your loaders to native TensorFlow and PyTorch
formats when you want to use them in a training pipeline. This includes both exporting the AgMLDataLoader
to a tf.data.Dataset
or torch.utils.data.DataLoader
,
but also internally converting data within the AgMLDataLoader
itself, enabling access to its core functionality.
# Export the loader as a `tf.data.Dataset`:
train_ds = loader.train_data.export_tensorflow()
# Convert to PyTorch tensors without exporting.
train_ds = loader.train_data
train_ds.as_torch_dataset()
You're now ready to use AgML for training your own models! Luckily, AgML comes with a training module that enables quick-start training of standard deep learning models on agricultural datasets. Training a grape detection model is as simple as the following code:
import agml
import agml.models
import albumentations as A
loader = agml.data.AgMLDataLoader('grape_detection_californiaday')
loader.split(train = 0.8, val = 0.1, test = 0.1)
processor = agml.models.preprocessing.EfficientDetPreprocessor(
image_size = 512, augmentation = [A.HorizontalFlip(p=0.5)]
)
loader.transform(processor)
model = agml.models.DetectionModel(num_classes=loader.num_classes)
model.run_training(loader)
Public Dataset Listing
AgML contains a wide variety of public datasets from various locations across the world:
The following is a comprehensive list of all datasets available in AgML. For more information,
you can use agml.data.public_data_sources(...)
with various filters to filter datasets according
to your desired specification.
iNatAg and iNatAg-mini
AgML provides an API with direct access to iNatAg (and iNatAg-mini), one of the world's largest collections of agricultural images dedicated for the task of image classification. Collectively, this dataset contains over 4 million images along with detailed species classificaations and enables access to a variety of large-scale agricultural machine learning tasks. You can instantiate the iNatAg (or iNatAg-mini, a smaller variant of iNatAg for smaller-scale applications) dataset as follows:
# To select a collection of scientific family names.
loader = agml.data.AgMLDataLoader.from_parent("iNatAg", filters={"family_name": ["...", "..."]})
# To select common names.
loader = agml.data.AgMLDataLoader.from_parent("iNatAg", filters={"common_name": "..."})
Usage Information
Using Public Agricultural Data
AgML aims to provide easy access to a range of existing public agricultural datasets The core of AgML's public data pipeline is
AgMLDataLoader
. You can use the AgMLDataLoader
or agml.data.download_public_dataset()
to download
the dataset locally from which point it will be automatically loaded from the disk on future runs.
From this point, the data within the loader can be split into train/val/test sets, batched, have augmentations and transforms
applied, and be converted into a training-ready dataset (including batching, tensor conversion, and image formatting).
To see the various ways in which you can use AgML datasets in your training pipelines, check out
the example notebook.
Annotation Formats
A core aim of AgML is to provide datasets in a standardized format, enabling the synthesizing of multiple datasets
into a single training pipeline. To this end, we provide annotations in the following formats:
- Image Classification: Image-To-Label-Number
- Object Detection: COCO JSON
- Semantic Segmentation: Dense Pixel-Wise
Contributions
We welcome contributions! If you would like to contribute a new feature, fix an issue that you've noticed, or even just mention
a bug or feature that you would like to see implemented, please don't hesitate to use the Issues tab to bring it to our attention.
See the contributing guidelines for more information.
Funding
This project is partly funded by the National AI Institute for Food Systems.
Owner metadata
- Name: AgML
- Login: Project-AgML
- Email:
- Kind: organization
- Description: AgML is a comprehensive library for agricultural machine learning.
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/96885544?v=4
- Repositories: 1
- Last ynced at: 2023-03-08T18:04:46.581Z
- Profile URL: https://github.com/Project-AgML
GitHub Events
Total
- Create event: 20
- Issues event: 3
- Release event: 4
- Watch event: 35
- Delete event: 8
- Issue comment event: 10
- Member event: 1
- Push event: 129
- Pull request review event: 25
- Pull request review comment event: 34
- Pull request event: 32
- Fork event: 4
Last Year
- Create event: 20
- Issues event: 3
- Release event: 4
- Watch event: 35
- Delete event: 8
- Issue comment event: 10
- Member event: 1
- Push event: 129
- Pull request review event: 25
- Pull request review comment event: 34
- Pull request event: 32
- Fork event: 4
Committers metadata
Last synced: 1 day ago
Total Commits: 914
Total Committers: 28
Avg Commits per committer: 32.643
Development Distribution Score (DDS): 0.248
Commits in past year: 147
Committers in past year: 7
Avg Commits per committer in past year: 21.0
Development Distribution Score (DDS) in past year: 0.612
Name | Commits | |
---|---|---|
amogh7joshi | j****n@g****m | 687 |
Naitik Jain | n****n@s****n | 54 |
Mason Earles | j****s@J****l | 31 |
Mason Earles | 2****s | 21 |
Leandro G. Almeida | l****a@g****m | 18 |
Heesup Yun | h****n@u****u | 16 |
Dario Guevara | d****a@u****u | 13 |
smbanx | s****x@g****m | 10 |
alexolenskyj | a****j@u****u | 9 |
Dario Guevara | d****1@g****m | 8 |
github-actions[bot] | g****] | 7 |
Mason Earles | j****s@c****u | 6 |
Pranav Raja | p****a@p****n | 5 |
Mason Earles | j****s@c****u | 5 |
pranavraja99 | p****9@i****m | 3 |
varunUCDavis | v****a@u****u | 3 |
dguevara | d****a@a****u@v****u | 3 |
Naitik | n****1@g****m | 2 |
Ooberaj | y****k@c****u | 2 |
Ooberaj | y****k@c****u | 2 |
ctyeong | c****g@g****m | 2 |
Mason Earles | j****s@c****u | 1 |
Ooberaj | y****k@Y****l | 1 |
Ooberaj | y****k@c****u | 1 |
Ooberaj | y****k@c****u | 1 |
Pranav Raja | p****a@P****l | 1 |
amnjoshi | a****i@a****u@v****u | 1 |
momtanu-ag | m****y@u****u | 1 |
Committer domains:
- ucdavis.edu: 5
- ad3.ucdavis.edu: 2
- campus-113-153.ucdavis.edu: 1
- campus-107-059.ucdavis.edu: 1
- campus-013-245.ucdavis.edu: 1
- campus-112-156.ucdavis.edu: 1
- campus-103-177.ucdavis.edu: 1
- campus-012-097.ucdavis.edu: 1
- pranavs-mbp.lan: 1
- campus-105-173.ucdavis.edu: 1
- spit.ac.in: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 28
Total pull requests: 49
Average time to close issues: 30 days
Average time to close pull requests: 6 days
Total issue authors: 14
Total pull request authors: 10
Average comments per issue: 4.46
Average comments per pull request: 0.24
Merged pull request: 45
Bot issues: 0
Bot pull requests: 0
Past year issues: 2
Past year pull requests: 21
Past year average time to close issues: 5 days
Past year average time to close pull requests: 8 days
Past year issue authors: 2
Past year pull request authors: 4
Past year average comments per issue: 5.0
Past year average comments per pull request: 0.0
Past year merged pull request: 21
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- ctyeong (7)
- Vincent-WangCH (4)
- masonearles (3)
- StupiddCupid (3)
- alexolenskyj (2)
- NielsRogge (1)
- khawar-islam (1)
- boudiafA (1)
- xml94 (1)
- Akshatha-Mohan (1)
- Icecream-blue-sky (1)
- andreaceruti (1)
- dariojavo (1)
- cmbadgujar10 (1)
Top Pull Request Authors
- amogh7joshi (22)
- lalmei (10)
- Ooberaj (5)
- dariojavo (3)
- naitikjain3071 (3)
- smbanx (2)
- momtanu-ag (1)
- ctyeong (1)
- pranavraja99 (1)
- alexolenskyj (1)
Top Issue Labels
- bug (12)
- synthetic (8)
- enhancement (4)
- dataset (2)
- documentation (1)
Top Pull Request Labels
- enhancement (16)
- release (9)
- bug (5)
- synthetic (5)
- dataset (5)
- documentation (4)
- models (1)
Package metadata
- Total packages: 3
-
Total downloads:
- pypi: 1,827 last-month
- Total dependent packages: 0 (may contain duplicates)
- Total dependent repositories: 1 (may contain duplicates)
- Total versions: 83
- Total maintainers: 2
proxy.golang.org: github.com/project-agml/agml
- Homepage:
- Documentation: https://pkg.go.dev/github.com/project-agml/agml#section-documentation
- Licenses: apache-2.0
- Latest release: v0.7.4 (published 9 days ago)
- Last Synced: 2025-04-29T16:04:32.251Z (1 day ago)
- Versions: 27
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 9.049%
- Average: 9.627%
- Dependent repos count: 10.204%
proxy.golang.org: github.com/Project-AgML/AgML
- Homepage:
- Documentation: https://pkg.go.dev/github.com/Project-AgML/AgML#section-documentation
- Licenses: apache-2.0
- Latest release: v0.7.4 (published 9 days ago)
- Last Synced: 2025-04-29T16:04:32.050Z (1 day ago)
- Versions: 27
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 9.049%
- Average: 9.627%
- Dependent repos count: 10.204%
pypi.org: agml
A comprehensive library for agricultural deep learning
- Homepage:
- Documentation: https://agml.readthedocs.io/
- Licenses: Apache 2.0
- Latest release: 0.7.4 (published 9 days ago)
- Last Synced: 2025-04-29T16:04:32.031Z (1 day ago)
- Versions: 29
- Dependent Packages: 0
- Dependent Repositories: 1
- Downloads: 1,827 Last month
-
Rankings:
- Dependent packages count: 10.109%
- Downloads: 15.771%
- Forks count: 16.876%
- Average: 18.433%
- Dependent repos count: 21.559%
- Stargazers count: 27.852%
- Maintainers (2)
Dependencies
- albumentations *
- matplotlib *
- numpy *
- opencv-python *
- pyyaml >=5.4.1
- scikit-learn *
- tensorflow *
- torch *
- torchvision *
- tqdm *
- line *
Score: 16.24695313788295