Skip to content

Commit

Permalink
added first draft of dataframe datamodule
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Konrad <84141230+manuelkonrad@users.noreply.github.com>
  • Loading branch information
manuelkonrad committed Nov 23, 2024
1 parent bcc0b43 commit d00c6b7
Show file tree
Hide file tree
Showing 9 changed files with 566 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
7 changes: 7 additions & 0 deletions docs/source/markdown/guides/reference/data/image/dataframe.md
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
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/anomalib/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -70,6 +70,7 @@ def get_datamodule(config: DictConfig | ListConfig | dict) -> AnomalibDataModule
"VideoDataFormat",
"get_datamodule",
"BTech",
"Dataframe",
"Datumaro",
"Folder",
"Folder3D",
Expand Down
4 changes: 3 additions & 1 deletion src/anomalib/data/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,6 +21,7 @@ class ImageDataFormat(str, Enum):
"""Supported Image Dataset Types."""

BTECH = "btech"
DATAFRAME = "dataframe"
DATUMARO = "datumaro"
FOLDER = "folder"
FOLDER_3D = "folder_3d"
Expand All @@ -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

0 comments on commit d00c6b7

Please sign in to comment.