Skip to content

Commit 598673a

Browse files
samet-akcayashwinvaidya17djdamelnAshwin Vaidya
authored
📝 Documentation refactor (#576)
* Add benchmark to tutorial * Move export to tutorials * Move hpo to tutorials * Move inference to tutorials * Move logging to tutorials * Create installation in tutorials * Create training to tutorials * Create tutorials index * Update conf.py file * Add anomalib logos to logos directory * Add data docs * Add algos * Add model docs * Add reference api * Remove blank line in metrics * Add reference guide * Add how to guides * Add developer guide * Add blog to how-to-guide * Remove guides directory * Add train custom data to how-to-guides * Fix typos * Add notebooks to how-to-guides * Add anomalib favicon * Add missing algo descriptions * Rename Reference to Reference Guide * Add how to add a new model * fix typos * Merge PR 544 * Minor refactor (#587) * 🛠 Fix PatchCore image-level score computation (#580) * fix patchcore image-level score computation * docstring and comment * remove default value for n_neighbors * torch.Tensor -> Tensor * Minor refactor Co-authored-by: Dick Ameln <[email protected]> Co-authored-by: Ashwin Vaidya <[email protected]> * Address Dicks comments Co-authored-by: Ashwin Vaidya <[email protected]> Co-authored-by: Dick Ameln <[email protected]> Co-authored-by: Ashwin Vaidya <[email protected]>
1 parent 7d20aa2 commit 598673a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1507
-969
lines changed

README.md

+39-5
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,38 @@ where the currently available models are:
117117
- [STFPM](anomalib/models/stfpm)
118118
- [GANomaly](anomalib/models/ganomaly)
119119

120-
## Exporting Model to ONNX or OpenVINO IR
120+
## Feature extraction & (pre-trained) backbones
121121

122-
It is possible to export your model to ONNX or OpenVINO IR
122+
The pre-trained backbones come from [PyTorch Image Models (timm)](https://github.com/rwightman/pytorch-image-models), which are wrapped by `FeatureExtractor`.
123123

124-
If you want to export your PyTorch model to an OpenVINO model, ensure that `export_mode` is set to `"openvino"` in the respective model `config.yaml`.
124+
For more information, please check our documentation or the [section about feature extraction in "Getting Started with PyTorch Image Models (timm): A Practitioner’s Guide"](https://towardsdatascience.com/getting-started-with-pytorch-image-models-timm-a-practitioners-guide-4e77b4bf9055#b83b:~:text=ready%20to%20train!-,Feature%20Extraction,-timm%20models%20also>).
125+
126+
Tips:
127+
128+
- Papers With Code has an interface to easily browse models available in timm: [https://paperswithcode.com/lib/timm](https://paperswithcode.com/lib/timm)
129+
130+
- You can also find them with the function `timm.list_models("resnet*", pretrained=True)`
131+
132+
The backbone can be set in the config file, two examples below.
133+
134+
Anomalib < v.0.4.0
125135

126136
```yaml
127-
optimization:
128-
export_mode: "openvino" # options: openvino, onnx
137+
model:
138+
name: cflow
139+
backbone: wide_resnet50_2
140+
pre_trained: true
141+
Anomalib > v.0.4.0 Beta - Subject to Change
142+
```
143+
144+
Anomalib >= v.0.4.0
145+
146+
```yaml
147+
model:
148+
class_path: anomalib.models.Cflow
149+
init_args:
150+
backbone: wide_resnet50_2
151+
pre_trained: true
129152
```
130153
131154
## Custom Dataset
@@ -222,6 +245,17 @@ python tools/inference/gradio_inference.py \
222245
--weights ./results/padim/mvtec/bottle/weights/model.ckpt
223246
```
224247

248+
## Exporting Model to ONNX or OpenVINO IR
249+
250+
It is possible to export your model to ONNX or OpenVINO IR
251+
252+
If you want to export your PyTorch model to an OpenVINO model, ensure that `export_mode` is set to `"openvino"` in the respective model `config.yaml`.
253+
254+
```yaml
255+
optimization:
256+
export_mode: "openvino" # options: openvino, onnx
257+
```
258+
225259
# Hyperparameter Optimization
226260

227261
To run hyperparameter optimization, use the following command:

anomalib/data/btech.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def __init__(
290290
seed: seed used for the random subset splitting
291291
create_validation_set: Create a validation subset in addition to the train and test subsets
292292
293-
Examples
293+
Examples:
294294
>>> from anomalib.data import BTech
295295
>>> datamodule = BTech(
296296
... root="./datasets/BTech",

anomalib/data/folder.py

+2
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ def __init__(
350350
351351
Examples:
352352
Assume that we use Folder Dataset for the MVTec/bottle/broken_large category. We would do:
353+
353354
>>> from anomalib.data import Folder
354355
>>> datamodule = Folder(
355356
... root="./datasets/MVTec/bottle/test",
@@ -370,6 +371,7 @@ def __init__(
370371
The dataset expects that mask annotation filenames must be same as the original filename.
371372
To this end, we modified mask filenames in MVTec AD bottle category.
372373
Now we could try folder data module using the mvtec bottle broken large category
374+
373375
>>> datamodule = Folder(
374376
... root="./datasets/bottle/test",
375377
... normal="good",

anomalib/data/mvtec.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def make_mvtec_dataset(
8989
MVTec AD dataset does not contain a validation set. Those wanting to create a validation set
9090
could set this flag to ``True``.
9191
92-
Example:
92+
Examples:
9393
The following example shows how to get training samples from MVTec AD bottle category:
9494
9595
>>> root = Path('./MVTec')
@@ -313,7 +313,7 @@ def __init__(
313313
seed: seed used for the random subset splitting
314314
create_validation_set: Create a validation subset in addition to the train and test subsets
315315
316-
Examples
316+
Examples:
317317
>>> from anomalib.data import MVTec
318318
>>> datamodule = MVTec(
319319
... root="./datasets/MVTec",

docs/blog/001-train-custom-dataset/README.md

-272
This file was deleted.

0 commit comments

Comments
 (0)