Commit f47674a
Enable tiled ensembe in v2 (#2660)
* Add training loop for ensemble
* Add model input size setup
* Move ens config to separate file
* Revert mvtec modifications
* Remove unused imports in mvtec
* Add batch adjustment to untiling
* Add predict step to ensemble
* Add comment and docstring to tile joining function
* Move tile joining to separate function
* Add joining for all tiled data
* Add joining for all box data
* Refactor pred. joining as modular class
* Fix box joining
* Add label and score joining
* Add ensemble visualization
* Add end of predict hook
* Add metric computation
* Fix metric thresholds
* Add removal of individual visualization
* Add demo1 notebook
* Add docstrings and cleanup
* Add memory benchmark
* Add modular class for storing predictions
* Add metric to separate class
* Refactor to support prediction data class
* Rename predictions class
* Add filesystem predictions class
* Add resized predictions class
* Fix joiner for classification task
* Add page peak to memory benchmark
* Add global stats calculation
* Add docstrings to stats calculation
* Refactor joiner for pipeline
* Refactor stats into pipeline
* Refactor metrics as pipeline block
* Refactor visualization as pipeline block
* Refactor postprocessing into a pipeline
* Add normalization and thresholding on joined predictions
* Refactor tiler to accept config file
* Add smoothing of tile joins.
* Refactor ensemble datamodule preparation
* Remove unused changes in dataloader
* Fix metric configuration
* Fix box coordinates in joining
* Add ensemble callbacks preparation function
* Fix box prediction bug in postprocess
* Add ensemble params to config
* Refactor postprocessing.
* Refactor post-processing
* Refactor predictions
* Code cleanup
* Optimize prediction storage
* Make join smoothing configurable
* Cleanup before PR
* Fix stats pipeline
* Fix logging strings
* Fix memory benchmark
* Fix tiler issues
* Fix import issues
* Fix naming in metrics and visualization
* Fix cyclic import
* Make logging lazy
* Refactor tiler tests
* Added collate tiling tests
* Added ensemble helper functions tests
* Refactor for dummy ensemble config
* Refactor for dummy base config
* Add tests for prediction storage
* Add tests for prediction joiner
* Add tests for visualization
* Fix small issues in tests
* Add metrics test
* Add post-processing tests
* Fix tiler to work with different instance
* Move seed setting inside train loop
* Fix pipeline stats bug
* Rename ensemble config fixture
* Add pipeline tests
* Fix config in pipeline tests
* Add training script test
* Fix types and docstrings
* Move and rename to tiled_ensemble
* Fix bug in label joining.
* Remove memory benchmark
* Cleanup files
* Fix metrics setup
* Rename collate function
* Add license to test files
* Rename fixtures
* Add more comments to tiled ensemble training
* Add start of training log message
* Refactor tiler to have explicit arguments
* Refactor pred. storage to have explicit arguments
* Refactor metrics to have explicit arguments
* Refactor visualization to have explicit arguments
* Refactor post-processing to have explicit arguments
* Sort imports
* Add test ensemble script
* Fix join smoothing bug
* Add more documentation to doc-strings
* Remove unused import
* Add brief tiled ensemble documentation
* Update typehints
* Make training args more clear
* Revert addition of no threshold option.
* Refactor normalization and threshold config
* Remove tiled ensemble from docs index
* Add comments to clarify parts of ensemble config
* Improve ensemble config comments
* Add num_tiles attribute to tiler.
* Fix metrics process docstring
* Fix visualization bug and cover with test
* Replace strings with enum
* Improve comments in joiner.
* Fix bug when model doesn't have anomaly maps.
* Improve docstrings (types, clarify).
* Fix visualization tests
* Fix dict membership checks
* Add saving of ensemble config file
* Update test script args
* Cover test script with tests
* Update export warning
* Fix case when no test or val data
* Improve documentation images
* Add images for documentation
* Add codacy suggestion
* Refactor joiner to single class
* Refactor storage names and config
* Update normalization and threshold stage names
* Add transforms independent input size to models
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Make collate function a datamodule attribute
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor tiled ensemble train into pipeline step
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor tiled ensemble prediction into pipeline step
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor tiled ensemble merging into pipeline step
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor tiled ensemble seam smoothing into pipeline step
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor tiled stats calculation into pipeline step
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix ckpt loading when predicting on test set.
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Add logging and add tqdm to pipeline steps.
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor normalization pipeline step
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor thresholding into new pipeline job
* Fix transforms issue when predicting with dataloader
* Add visualization as new pipeline step
* Add metrics as new pipeline step
* Format the code and address some lint problems
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
* Add code to skip test if test split is none
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
* Add accelerator to metrics and smoothing
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
* Make threshold acq helper function and add to threshold to metrics
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
* Make a separate test pipeline
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
* Restructure tiled ensemble files into directories
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
* Pipeline code cleanup
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
* Remove old tiled ensemble files
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Remove old post processing files
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix sigma value read in smoothing
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Update stats calc and normalization
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Update args naming convention
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor code for nice config
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Update docs structure for new system
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Cleanup train code
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix test script args
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Update box merging
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor helper function tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Small changes in helper and engine
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor merging tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor tiling tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor metrics test
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Add support for different threshold methods
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Format tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Change test to predict
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor stats calculation tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor prediction data tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Update metrics tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Move metrics tests to components
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor seam smoothing tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor normalization tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Move mock stats to conftest
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix typehints for generator
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor threshold tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Temporarily disable box minmax
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Add tiled ensemble integration test
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix normalization tests and add additional merging test
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Add tile collater tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Change dataset in tests to dummy
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Format and fix linter errors
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Format and some cleanup
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Rename predict to eval
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Update docs for refactored version of code
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Cleanup the docs
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Update ensemble engine
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Remove boxes from pipelines and tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix TODO comment issue
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix unused model in ens. engine
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix path case in test
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Change temporary dir to project_path
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Change mvtec to MVTec in test path
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
* Update ensemble tiling and fix tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Update normalisation and threshold on tile level
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix datamodule data size
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor pred. data and merging
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Initial train refactor
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactored working training
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix merging missing items, shapes + add test.
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix smoothing and tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix stats comp and tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix model input_size and tests
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix norm, thresh and metrics
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Refactor test pipeline
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix visualisation
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Small fixes
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix visualisation
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix tests and some linting
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Add lates config
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix linter errors for tiled ensemble
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix type-checking errors
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix torch.Tensor usage
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Add more details to docstrings.
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Fix MVTecAD class in ens config
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
* Update tiled ensemble docs
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
---------
Signed-off-by: blaz-r <blaz.rolih@gmail.com>
Signed-off-by: Blaz Rolih <blaz.rolih@gmail.com>
Co-authored-by: Samet Akcay <samet.akcay@intel.com>
Co-authored-by: Rajesh Gangireddy <rajesh.gangireddy@intel.com>1 parent d496dff commit f47674a
File tree
34 files changed
+3739
-3
lines changed- docs/source/markdown/guides/how_to/pipelines
- src/anomalib
- data/datamodules/base
- pipelines/tiled_ensemble
- components
- utils
- tests
- integration/pipelines
- unit/pipelines/tiled_ensemble
- tools/tiled_ensemble
34 files changed
+3739
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
9 | 16 | | |
10 | 17 | | |
11 | 18 | | |
| |||
Lines changed: 162 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
| 131 | + | |
| 132 | + | |
129 | 133 | | |
130 | 134 | | |
131 | 135 | | |
| |||
362 | 366 | | |
363 | 367 | | |
364 | 368 | | |
365 | | - | |
| 369 | + | |
366 | 370 | | |
367 | 371 | | |
368 | 372 | | |
| |||
376 | 380 | | |
377 | 381 | | |
378 | 382 | | |
379 | | - | |
| 383 | + | |
380 | 384 | | |
381 | 385 | | |
382 | 386 | | |
| |||
390 | 394 | | |
391 | 395 | | |
392 | 396 | | |
393 | | - | |
| 397 | + | |
394 | 398 | | |
395 | 399 | | |
396 | 400 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments