File tree 1 file changed +15
-12
lines changed
src/anomalib/visualization/image
1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change 4
4
# SPDX-License-Identifier: Apache-2.0
5
5
6
6
from pathlib import Path
7
- from typing import Any
7
+ from typing import TYPE_CHECKING , Any
8
8
9
- from lightning .pytorch import Trainer
9
+ # Only import types during type checking to avoid circular imports
10
+ if TYPE_CHECKING :
11
+ from lightning .pytorch import Trainer
12
+
13
+ from anomalib .data import ImageBatch
14
+ from anomalib .models import AnomalibModule
10
15
11
- from anomalib .data import ImageBatch
12
- from anomalib .models .components .base import AnomalibModule
13
16
from anomalib .utils .path import generate_output_filename
14
17
from anomalib .visualization .base import Visualizer
15
18
@@ -139,10 +142,10 @@ def __init__(
139
142
140
143
def on_test_batch_end (
141
144
self ,
142
- trainer : Trainer ,
143
- pl_module : AnomalibModule ,
144
- outputs : ImageBatch ,
145
- batch : ImageBatch ,
145
+ trainer : " Trainer" ,
146
+ pl_module : " AnomalibModule" ,
147
+ outputs : " ImageBatch" ,
148
+ batch : " ImageBatch" ,
146
149
batch_idx : int ,
147
150
dataloader_idx : int = 0 ,
148
151
) -> None :
@@ -177,10 +180,10 @@ def on_test_batch_end(
177
180
178
181
def on_predict_batch_end (
179
182
self ,
180
- trainer : Trainer ,
181
- pl_module : AnomalibModule ,
182
- outputs : ImageBatch ,
183
- batch : ImageBatch ,
183
+ trainer : " Trainer" ,
184
+ pl_module : " AnomalibModule" ,
185
+ outputs : " ImageBatch" ,
186
+ batch : " ImageBatch" ,
184
187
batch_idx : int ,
185
188
dataloader_idx : int = 0 ,
186
189
) -> None :
You can’t perform that action at this time.
0 commit comments