-
Notifications
You must be signed in to change notification settings - Fork 821
π§ refactor(data): Polish BMAD dataset #2981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ashwinvaidya17
merged 5 commits into
open-edge-platform:feature/dataset/bmad
from
ashwinvaidya17:ashwin/bmad_fixes
Oct 6, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8bd5e77
π§Ή Polish dataset
ashwinvaidya17 b8f71e6
Update src/anomalib/data/datamodules/image/bmad.py
ashwinvaidya17 22ed937
Merge branch 'main' into ashwin/bmad_fixes
ashwinvaidya17 fed9bbc
Merge branch 'feature/dataset/bmad' into ashwin/bmad_fixes
ashwinvaidya17 74e2461
Merge branch 'feature/dataset/bmad' into ashwin/bmad_fixes
ashwinvaidya17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
docs/source/markdown/guides/reference/data/datamodules/image/bmad.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# BMAD Datamodule | ||
|
||
```{eval-rst} | ||
.. automodule:: anomalib.data.datamodules.image.bmad | ||
:members: | ||
:show-inheritance: | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class_path: anomalib.data.BMAD | ||
init_args: | ||
root: ./datasets/BMAD | ||
category: Brain | ||
train_batch_size: 32 | ||
eval_batch_size: 32 | ||
num_workers: 8 | ||
test_split_mode: from_dir | ||
test_split_ratio: 0.2 | ||
val_split_mode: from_dir | ||
val_split_ratio: null | ||
seed: null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright (C) 2025 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
"""Unit Tests - BMAD Datamodule.""" | ||
|
||
from pathlib import Path | ||
|
||
import pytest | ||
from torchvision.transforms.v2 import Resize | ||
|
||
from anomalib.data import BMAD | ||
from anomalib.data.utils import ValSplitMode | ||
from tests.unit.data.datamodule.base.image import _TestAnomalibImageDatamodule | ||
|
||
|
||
class TestBMAD(_TestAnomalibImageDatamodule): | ||
"""BMAD Datamodule Unit Tests.""" | ||
|
||
@pytest.fixture() | ||
@staticmethod | ||
def datamodule(dataset_path: Path) -> BMAD: | ||
"""Create and return a BMAD datamodule.""" | ||
datamodule_ = BMAD( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this download the dataset ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this will download the entire dataset |
||
root=dataset_path / "bmad", | ||
category="dummy", | ||
train_batch_size=4, | ||
eval_batch_size=4, | ||
val_split_mode=ValSplitMode.FROM_DIR, | ||
augmentations=Resize((256, 256)), | ||
) | ||
datamodule_.prepare_data() | ||
datamodule_.setup() | ||
|
||
return datamodule_ | ||
|
||
@pytest.fixture() | ||
@staticmethod | ||
def fxt_data_config_path() -> str: | ||
"""Return the path to the test data config.""" | ||
return "examples/configs/data/bmad.yaml" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.