Skip to content

Commit

Permalink
Refactor/samet/data (#8)
Browse files Browse the repository at this point in the history
* Initial commit

* Update README.md

* Update README.md

Convert openvino badge to purple

* Add docs workflow

* temp disable rule

* Fix workflow

* Fix workflow

* Fix workflow

* Fix workflow

* Fix workflow

* Fix docs build loc

* Fix sphinx-build + path

* Add debug options'

* Fix folder issues

* checkout branch

* Move docs to root

* Move docs to root

* fix broken site

* Enable checks

* Refactor `anomalib.dataset` into `anomalib.data`

* Refactor dataset

* rebased development

* Resolved merged conflicts

* Resolved merged conflicts

* Resolved merged conflicts

* Fix workflow

* Fix workflow

* Fix workflow

* Fix workflow

* Fix workflow

* Fix docs build loc

* Add debug options'

* checkout branch

* Move docs to root

* Move docs to root

* fix broken site

* Refactor `anomalib.dataset` into `anomalib.data`

* Refactor dataset

* updated docs.yaml with development branch

* resolved conflicts

* Removed unrelated changes

* fix wrong data import

* data is now imported based on dataset.format

* Apply pydocstyle

Co-authored-by: Ashwin Vaidya <ashwin.vaidya@intel.com>
  • Loading branch information
samet-akcay and ashwinvaidya17 committed Nov 30, 2021
1 parent 6088790 commit 58393a7
Show file tree
Hide file tree
Showing 29 changed files with 224 additions and 1,008 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[![pytorch](https://img.shields.io/badge/pytorch-1.7.1%2B-orange)]()
[![openvino](https://img.shields.io/badge/openvino-2021.4-purple)]()
![example branch parameter](https://github.com/openvinotoolkit/anomalib/actions/workflows/tox.yml/badge.svg?branch=development)
[![coverage report](https://gitlab-icv.inn.intel.com/algo_rnd_team/anomaly/badges/development/coverage.svg)](https://gitlab-icv.inn.intel.com/algo_rnd_team/anomaly/-/commits/development)


This repository contains state-of-the art anomaly detection algorithms trained and evaluated on both public and private
Expand Down
2 changes: 1 addition & 1 deletion anomalib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# See the License for the specific language governing permissions
# and limitations under the License.

__version__ = "0.1.0"
__version__ = "0.1.1"
2 changes: 1 addition & 1 deletion anomalib/core/callbacks/nncf_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pytorch_lightning import Callback
from torch.utils.data.dataloader import DataLoader

from anomalib.datasets import get_datamodule
from anomalib.data import get_datamodule


def criterion_fn(outputs, criterion):
Expand Down
4 changes: 2 additions & 2 deletions anomalib/core/callbacks/visualizer_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from anomalib import loggers
from anomalib.core.model import AnomalyModule
from anomalib.core.results import SegmentationResults
from anomalib.datasets.utils import Denormalize
from anomalib.data.transforms import Denormalize
from anomalib.utils.metrics import compute_threshold_and_f1_score
from anomalib.utils.post_process import compute_mask, superimpose_anomaly_map
from anomalib.utils.visualizer import Visualizer
Expand All @@ -22,7 +22,7 @@ class VisualizerCallback(Callback):
the predicted error heat map, and the predicted segmentation mask.
To save the images to the filesystem, add the 'local' keyword to the project.log_images_to parameter in the
config.yaml file. .
config.yaml file.
"""

def __init__(self):
Expand Down
4 changes: 2 additions & 2 deletions anomalib/core/model/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
from torch import Tensor, nn

from anomalib.core.model import AnomalyModule
from anomalib.datasets.transforms.pre_process import PreProcessor
from anomalib.datasets.utils import read_image
from anomalib.data.transforms.pre_process import PreProcessor
from anomalib.data.utils import read_image
from anomalib.models import get_model
from anomalib.utils.post_process import superimpose_anomaly_map

Expand Down
17 changes: 2 additions & 15 deletions anomalib/datasets/__init__.py → anomalib/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from omegaconf import DictConfig, ListConfig
from pytorch_lightning import LightningDataModule

from .anomaly_dataset import AnomalyDataModule
from .mvtec import MVTecDataModule


Expand All @@ -37,26 +36,14 @@ def get_datamodule(config: Union[DictConfig, ListConfig]):

if config.dataset.format.lower() == "mvtec":
datamodule = MVTecDataModule(
# TODO: Remove config values. IAAALD-211
root=config.dataset.path,
category=config.dataset.category,
image_size=config.dataset.image_size,
crop_size=config.dataset.image_size,
image_size=(config.dataset.image_size[0], config.dataset.image_size[0]),
train_batch_size=config.dataset.train_batch_size,
test_batch_size=config.dataset.test_batch_size,
num_workers=config.dataset.num_workers,
)
elif config.dataset.format.lower() == "anomaly_dataset":
datamodule = AnomalyDataModule(
root=config.dataset.path,
url=config.dataset.url,
category=config.dataset.category,
task=config.dataset.task,
label_format=config.dataset.label_format,
train_batch_size=config.dataset.train_batch_size,
test_batch_size=config.dataset.test_batch_size,
num_workers=config.dataset.num_workers,
image_size=(config.dataset.image_size[0], config.dataset.image_size[1]),
)
else:
raise ValueError("Unknown dataset!")

Expand Down
Loading

0 comments on commit 58393a7

Please sign in to comment.