Skip to content

Dataframe datamodule #2403

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

- πŸš€ Add Dataframe datamodule by @manuelkonrad in https://github.com/openvinotoolkit/anomalib/pull/2403

### Changed

### Deprecated
77 changes: 77 additions & 0 deletions configs/data/dataframe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
class_path: anomalib.data.Dataframe
init_args:
name: bottle
root: "datasets/MVTec/bottle"
train_batch_size: 32
eval_batch_size: 32
num_workers: 8
task: segmentation
transform: null
train_transform: null
eval_transform: null
test_split_mode: from_dir
test_split_ratio: 0.2
val_split_mode: same_as_test
val_split_ratio: 0.5
seed: null
samples:
- image_path: train/good/000.png
label_index: 0
mask_path: ""
split: train
- image_path: train/good/001.png
label_index: 0
mask_path: ""
split: train
- image_path: train/good/002.png
label_index: 0
mask_path: ""
split: train
- image_path: train/good/003.png
label_index: 0
mask_path: ""
split: train
- image_path: train/good/004.png
label_index: 0
mask_path: ""
split: train
- image_path: test/bad/000.png
label_index: 1
mask_path: ground_truth/bad/000_mask.png
split: test
- image_path: test/bad/002.png
label_index: 1
mask_path: ground_truth/bad/002_mask.png
split: test
- image_path: test/bad/004.png
label_index: 1
mask_path: ground_truth/bad/004_mask.png
split: test
- image_path: test/good/000.png
label_index: 0
mask_path: ""
split: test
- image_path: test/good/001.png
label_index: 0
mask_path: ""
split: test
- image_path: test/good/003.png
label_index: 0
mask_path: ""
split: test
- image_path: test/bad/001.png
label_index: 1
mask_path: ground_truth/bad/001_mask.png
split: test
- image_path: test/bad/003.png
label_index: 1
mask_path: ground_truth/bad/003_mask.png
split: test
- image_path: test/good/002.png
label_index: 0
mask_path: ""
split: test
- image_path: test/good/004.png
label_index: 0
mask_path: ""
split: test
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Dataframe Data

```{eval-rst}
.. automodule:: anomalib.data.image.dataframe
:members:
:show-inheritance:
```
7 changes: 7 additions & 0 deletions docs/source/markdown/guides/reference/data/image/index.md
Original file line number Diff line number Diff line change
@@ -16,6 +16,13 @@ Learn more about BTech dataset.
Learn more about custom folder dataset.
:::

:::{grid-item-card} Dataframe
:link: ./dataframe
:link-type: doc

Learn more about custom dataframe dataset.
:::

:::{grid-item-card} Kolektor
:link: ./kolektor
:link-type: doc
3 changes: 2 additions & 1 deletion src/anomalib/data/__init__.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

from .base import AnomalibDataModule, AnomalibDataset
from .depth import DepthDataFormat, Folder3D, MVTec3D
from .image import BTech, Datumaro, Folder, ImageDataFormat, Kolektor, MVTec, Visa
from .image import BTech, Dataframe, Datumaro, Folder, ImageDataFormat, Kolektor, MVTec, Visa
from .predict import PredictDataset
from .utils import LabelName
from .video import Avenue, ShanghaiTech, UCSDped, VideoDataFormat
@@ -70,6 +70,7 @@ def get_datamodule(config: DictConfig | ListConfig | dict) -> AnomalibDataModule
"VideoDataFormat",
"get_datamodule",
"BTech",
"Dataframe",
"Datumaro",
"Folder",
"Folder3D",
4 changes: 3 additions & 1 deletion src/anomalib/data/image/__init__.py
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
from enum import Enum

from .btech import BTech
from .dataframe import Dataframe
from .datumaro import Datumaro
from .folder import Folder
from .kolektor import Kolektor
@@ -20,6 +21,7 @@ class ImageDataFormat(str, Enum):
"""Supported Image Dataset Types."""

BTECH = "btech"
DATAFRAME = "dataframe"
DATUMARO = "datumaro"
FOLDER = "folder"
FOLDER_3D = "folder_3d"
@@ -29,4 +31,4 @@ class ImageDataFormat(str, Enum):
VISA = "visa"


__all__ = ["BTech", "Datumaro", "Folder", "Kolektor", "MVTec", "Visa"]
__all__ = ["BTech", "Dataframe", "Datumaro", "Folder", "Kolektor", "MVTec", "Visa"]
Loading