Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ci

on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

jobs:
test:
Expand Down Expand Up @@ -31,10 +31,6 @@ jobs:
uv venv --python ${{ matrix.python-version }}
uv sync --dev

- name: Run pre-commit
continue-on-error: true
run: make pre-commit

- name: Run tests
# For example, using `pytest`
run: make test
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: docs
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

permissions:
contents: read
Expand All @@ -14,8 +14,8 @@ concurrency:
jobs:
deploy:
environment:
name: documenation
url: ${{steps.deployement.outputs.page_url}}
name: documentation
url: ${{steps.deployment.outputs.page_url}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -25,7 +25,7 @@ jobs:
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
python-version: '3.12'
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]
workflow_dispatch:

permissions:
contents: read
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/update-datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- agml/_assets/public_datasources.json
branches:
- dev
workflow_dispatch:

permissions: write-all

Expand All @@ -18,18 +19,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: dev
- name: Set up Python 3.8
uses: actions/setup-python@v3
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip uv
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python3 setup.py install
uv pip install --system -e .
- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ to your desired specification.
[iNatAg](https://github.com/Project-AgML/AgML/blob/main/docs/datasets/iNatAg.md) | Image Classification | 4720903 |
[iNatAg-mini](https://github.com/Project-AgML/AgML/blob/main/docs/datasets/iNatAg-mini.md) | Image Classification | 560844 |
[soybean_insect_classification](https://github.com/Project-AgML/AgML/blob/main/docs/datasets/soybean_insect_classification.md) | Image Classification | 6410 |
[mango_leaf_disease_classification](https://github.com/Project-AgML/AgML/blob/main/docs/datasets/mango_leaf_disease_classification.md) | Image Classification | 4000 |

## iNatAg and iNatAg-mini

Expand Down Expand Up @@ -249,4 +250,4 @@ a bug or feature that you would like to see implemented, please don't hesitate t
See the [contributing guidelines](/CONTRIBUTING.md) for more information.

## Funding
This project is partly funded by the [National AI Institute for Food Systems](https://aifs.ucdavis.edu).
This project is partly funded by the [National AI Institute for Food Systems](https://aifs.ucdavis.ed
15 changes: 13 additions & 2 deletions agml/data/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ def apply_filters(self, **filters):
if not filters:
return self

# Validate filters against known metadata keys
valid_keys = {
'location', 'n_images', 'num_images', 'ml_task', 'ag_task',
'sensor_modality', 'real_synthetic', 'platform', 'input_data_format',
'annotation_format', 'docs_url', 'classes', 'parent_dataset'
}
for key in filters:
if key not in valid_keys:
raise ValueError(f"Invalid filter: '{key}'. Must be one of {valid_keys}")

filtered_sources = []
for source, meta in self._sources.items():
if self._matches(meta, filters):
Expand All @@ -95,7 +105,8 @@ def _matches(self, meta, filters):
desired = desired.lower()
except ValueError:
raise ValueError("Location filter must be in the format 'key:value'.")
if meta.get('location', {}).get(loc_key) != desired:
loc_data = meta.get('location') or {}
if loc_data.get(loc_key) != desired:
return False
elif key in ['n_images', 'num_images']:
try:
Expand Down Expand Up @@ -142,7 +153,7 @@ def __repr__(self):
table.add_row(
source_name,
meta.get("ml_task", "N/A"), # Handle missing 'ml_task'
f"{meta['location']['continent']}, {meta['location']['country']}" if "location" in meta else "N/A",
f"{meta['location']['continent']}, {meta['location']['country']}" if meta.get("location") else "N/A",
str(meta.get("n_images", "N/A")), # prints N/A if number of images are not there.
)

Expand Down
2 changes: 2 additions & 0 deletions agml/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def copyright_print(name, location=None):
# Create license message
if not license_info: # Handle empty license
license_msg = Text("License: None specified", style="yellow")
license_more_info = ""
license_url = ""
else:
license_msg = Text.assemble(("This dataset is licensed under ", "bold cyan"), (f"{license_info}", "green"))
if license_info in _LICENSE_TO_URL:
Expand Down
24 changes: 24 additions & 0 deletions docs/datasets/mango_leaf_disease_classification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

# `mango_leaf_disease_classification`

## Dataset Metadata

| Metadata | Value |
| --- | --- |
| **Machine Learning Task** | image_classification |
| **Agricultural Task** | disease_classification |
| **Location** | Bangladesh, Asia |
| **Sensor Modality** | RGB |
| **Real or Synthetic** | real |
| **Platform** | handheld |
| **Input Data Format** | JPG |
| **Annotation Format** | directory_names |
| **Number of Images** | 4000 |
| **Documentation** | https://data.mendeley.com/datasets/hxsnvwty3r/1 |
| **Stats/Mean** | [0.665, 0.690, 0.689] |
| **Stats/Standard Deviation** | [0.197, 0.186, 0.257] |
| **Classes** | Anthracnose, Bacterial_Canker, Cutting_Weevil, Die_Back, Gall_Midge, Healthy, Powdery_Mildew, Sooty_Mold |

## Examples

![Example Images for mango_leaf_disease_classification](https://github.com/Project-AgML/AgML/blob/main/docs/sample_images/mango_leaf_disease_classification_examples.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading