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 3 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 (about 5 years ago)
- Default Branch: main
- Last Pushed: 2026-11-24T05:46:49.000Z (7 days ago)
- Last Synced: 2026-11-30T18:31:19.355Z (about 3 hours 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
- Size: 213 MB
- Stars: 357
- Watchers: 17
- Forks: 54
- Open Issues: 14
- Releases: 31
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Authors: AUTHORS
README.md
ðĻðŋâðŧðĐð―âðŧððŠī Want to join the AI Institute for Food Systems team and help lead AgML development? ðŠīððĐðžâðŧðĻðŧâðŧ
We'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.
AgML supports both the TensorFlow and PyTorch machine learning frameworks.
To browse our latest datasets, view our full set of documentation, and compare model performance on your crops / tasks of interest, please visit project-agml.github.io.
Installation
To install the latest release of AgML, run the following command:
pip install agml
Quick Start
AgML datasets are hosted on the Hugging Face Hub under the Project-AgML
organization. You can start off by using the HuggingFaceDataLoader to download and load a dataset directly into a
native Hugging Face DatasetDict:
from agml.data import HuggingFaceDataLoader
# Load a dataset from the Hub
loader = HuggingFaceDataLoader("Project-AgML/apple_flower_segmentation")
# Load a specific config/subset (e.g. an augmented variant)
loader = HuggingFaceDataLoader("Project-AgML/apple_flower_segmentation", config="augmented")
HuggingFaceDataLoader automatically casts image-like columns (image, mask, and image-typed label columns) to
the Hugging Face Image type for decoded pixel access.
You can split the dataset into train/val/test sets, with optional stratification across one or more columns:
dataset = loader.split(val_size=0.1, test_size=0.1, stratify_cols="label")
# Returns a DatasetDict with 'train', 'val', and 'test' splits
# Access the underlying DatasetDict at any time
dataset = loader.dataset
For any preprocessing, inference, or training beyond loading and splitting, use the
datasets and transformers
libraries directly. Since loader.dataset is a native Hugging Face DatasetDict, it works out of the box with
datasets' map, filter, and with_transform methods for preprocessing, and with transformers' Trainer,
Pipeline, and model classes for training and inference â there's no separate AgML-specific processing API to learn.
from transformers import AutoImageProcessor, AutoModelForImageClassification, Trainer
processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
model = AutoModelForImageClassification.from_pretrained(
"google/vit-base-patch16-224",
num_labels=dataset["train"].features["label"].num_classes,
)
def preprocess(batch):
batch["pixel_values"] = processor(batch["image"], return_tensors="pt")["pixel_values"]
return batch
dataset = dataset.with_transform(preprocess)
trainer = Trainer(model=model, train_dataset=dataset["train"], eval_dataset=dataset["val"])
trainer.train()
Public Datasets
AgML contains a wide variety of public datasets from various locations across the world:

Use the Dataset Search experience for filtering and previews. For programmatic filtering,
agml.data.public_data_sources(...) supports task and modality filters.
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).
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. Datasets on the Hugging Face Hub encode annotations as columns on the underlying
Dataset/DatasetDict:
- Image Classification: a
labelcolumn of typeClassLabel. - Object Detection: an
objectscolumn, holding COCO-style bounding boxes (un-normlized [x_min, y_min, width, height]) and corresponding category IDs as a ClassLabel per image. - Semantic Segmentation: a
maskcolumn, a single-channel (L-mode) image the same size as the corresponding image.
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, or the guide to contributing leaderboard results if you have benchmark results to add.
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: 2026-11-29T18:05:17.387Z
- Profile URL: https://github.com/Project-AgML
GitHub Events
Total
- Create event: 25
- Delete event: 8
- Fork event: 11
- Issue comment event: 15
- Issues event: 4
- Member event: 1
- Pull request event: 34
- Pull request review comment event: 34
- Pull request review event: 25
- Push event: 145
- Release event: 4
- Watch event: 66
Last Year
- Create event: 5
- Fork event: 5
- Pull request event: 2
- Push event: 16
- Watch event: 7
Committers metadata
Last synced: 1 day ago
Total Commits: 956
Total Committers: 35
Avg Commits per committer: 27.314
Development Distribution Score (DDS): 0.281
Commits in past year: 42
Committers in past year: 7
Avg Commits per committer in past year: 6.0
Development Distribution Score (DDS) in past year: 0.452
| Name | Commits | |
|---|---|---|
| amogh7joshi | j****n@g****m | 687 |
| Naitik Jain | n****n@s****n | 54 |
| Mason Earles | j****s@J****l | 31 |
| Jared Smith | j****h@u****u | 23 |
| 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 |
| eranario | e****o@u****u | 9 |
| 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 |
| hkaman7 | h****r@g****m | 4 |
| dguevara | d****a@a****u@v****u | 3 |
| pranavraja99 | p****9@i****m | 3 |
| varunUCDavis | v****a@u****u | 3 |
| Naitik | n****1@g****m | 2 |
| Ooberaj | y****k@c****u | 2 |
| Ooberaj | y****k@c****u | 2 |
| Lars Lundqvist | 1****V | 2 |
| Urmil Chandarana | u****a@g****m | 2 |
| ctyeong | c****g@g****m | 2 |
| ninjacat272 | 8****2 | 1 |
| Mason Earles | j****s@c****u | 1 |
| Ooberaj | y****k@Y****l | 1 |
| Ooberaj | y****k@c****u | 1 |
| and 5 more... | ||
Committer domains:
- ucdavis.edu: 7
- 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: 13 days ago
Total issues: 31
Total pull requests: 62
Average time to close issues: 28 days
Average time to close pull requests: 6 days
Total issue authors: 17
Total pull request authors: 17
Average comments per issue: 3.77
Average comments per pull request: 0.19
Merged pull request: 54
Bot issues: 0
Bot pull requests: 0
Past year issues: 3
Past year pull requests: 14
Past year average time to close issues: 4 days
Past year average time to close pull requests: 5 days
Past year issue authors: 3
Past year pull request authors: 7
Past year average comments per issue: 2.0
Past year average comments per pull request: 0.0
Past year merged pull request: 10
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- ctyeong (7)
- masonearles (4)
- Vincent-WangCH (3)
- StupiddCupid (3)
- alexolenskyj (2)
- cmbadgujar10 (1)
- dariojavo (1)
- andreaceruti (1)
- Icecream-blue-sky (1)
- Akshatha-Mohan (1)
- sstiene (1)
- xml94 (1)
- boudiafA (1)
- stardust-96 (1)
- bradezard131 (1)
Top Pull Request Authors
- amogh7joshi (21)
- lalmei (10)
- js2552 (7)
- Ooberaj (5)
- naitikjain3071 (3)
- dariojavo (3)
- eranario (2)
- smbanx (2)
- bharathsri272 (1)
- alexolenskyj (1)
- LasseQV (1)
- ctyeong (1)
- momtanu-ag (1)
- hkaman7 (1)
- pranavraja99 (1)
Top Issue Labels
- bug (11)
- synthetic (7)
- enhancement (4)
- dataset (3)
- documentation (1)
- question (1)
Top Pull Request Labels
- enhancement (16)
- release (9)
- synthetic (5)
- bug (5)
- dataset (5)
- documentation (4)
- models (1)
Package metadata
- Total packages: 2
- Total downloads: unknown
- Total dependent packages: 0 (may contain duplicates)
- Total dependent repositories: 0 (may contain duplicates)
- Total versions: 61
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.8.2 (published about 1 month ago)
- Last Synced: 2026-11-29T18:01:27.566443Z (1 day ago)
- Versions: 30
- 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.8.3 (published 3 days ago)
- Last Synced: 2026-11-29T18:01:27.763809Z (1 day ago)
- Versions: 31
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 9.049%
- Average: 9.627%
- Dependent repos count: 10.204%
Dependencies
- actions/checkout v4 composite
- astral-sh/setup-uv v3 composite
- release-drafter/release-drafter v6 composite
- cmake
- cuda
- cuda-nvcc
- cudatoolkit
- gcc 12
- glew
- glfw
- gxx
- libgl
- libglu
- libx11-devel-cos6-x86_64
- libxrandr-devel-cos6-x86_64
- make
- mesa-libgl-cos7-x86_64
- mesa-libgl-devel-cos6-x86_64
- pip
- xorg-libx11
- xorg-libxcursor
- xorg-libxext
- xorg-libxi
- xorg-libxinerama
- xorg-libxrandr
- xorg-libxrender
- 130 dependencies
- albumentations >=1.4.18
- dict2xml >=1.7.6
- ipywidgets >=8.1.5
- matplotlib >=3.7.5
- numpy >=1.24.4
- opencv-python >=4.10.0.84
- opencv-python-headless >=4.10.0.84
- pyyaml >=6.0.2
- requests >=2.0.0
- rich >=14.0.0
- scikit-learn >=1.3.2
- tqdm >=4.67.0
Score: -Infinity