🐞 <title>engine = Engine(max_epochs=10) is not work??? #2872
-
Describe the bugset like this:engine = Engine(max_epochs=10) DatasetN/A ModelN/A Steps to reproduce the behaviorall package is well done. but i con't change the max_epoch?? OS informationOS information:
Expected behaviorchange max_epoch ScreenshotsNo response Pip/GitHubpip What version/branch did you use?2.1.0 Configuration YAMLnone Logsfrom anomalib.models import Patchcore
from anomalib.engine import Engine
from anomalib.data import Folder
import torch
# 创建数据模块
datamodule = Folder(
name="OCT",
root="Dataset_Denoise/train",
normal_dir="normal",
abnormal_dir="abnormal",
)
datamodule.setup()
# 初始化模型
model = Patchcore()
# 初始化Engine时通过trainer_kwargs传递所有训练参数
engine = Engine(max_epochs=10)
# 训练模型
engine.fit(datamodule=datamodule, model=model)
output:
| Name | Type | Params | Mode
----------------------------------------------------------
0 | pre_processor | PreProcessor | 0 | train
1 | post_processor | PostProcessor | 0 | train
2 | evaluator | Evaluator | 0 | train
3 | model | PatchcoreModel | 24.9 M | train
----------------------------------------------------------
24.9 M Trainable params
0 Non-trainable params
24.9 M Total params
99.450 Total estimated model params size (MB)
19 Modules in train mode
174 Modules in eval mode
Selecting Coreset Indices.: 100%|████████████████| 15257/15257 [00:11<00:00, 1316.54it/s]
Epoch 0: 100%|█████████████████████████████████████████████████| 5/5 [00:14<00:00, 0.33it/s]`Trainer.fit` stopped: `max_epochs=1` reached.
Epoch 0: 100%|█████████████████████████████████████████████████| 5/5 [00:15<00:00, 0.32it/s]
(OOD) wyk@bly-SYS-741GE-TNRT:~/OOD$ Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Thanks for submitting this issue! It has been added to our triage queue. A maintainer will review it shortly. |
Beta Was this translation helpful? Give feedback.
-
Hi @wyk-study |
Beta Was this translation helpful? Give feedback.
Hi @wyk-study
PatchCore does not use epochs.
During the "training phase", it extracts features once for all the normal images. There is no loss computation involved.
Please read the readme.md of patchcore model for a summary : https://github.com/open-edge-platform/anomalib/blob/main/src/anomalib/models/image/patchcore/README.md