Replies: 4 comments 3 replies
-
I've fixed it How can I solve it? |
Beta Was this translation helpful? Give feedback.
-
中国人是吧 |
Beta Was this translation helpful? Give feedback.
-
好的,刚刚我又尝试了一下,删去数据集依旧无法正常运行,我再问一下其他人,非常感谢!有解决方法一定告诉您!
Covi
***@***.***
…------------------ Original ------------------
From: zhaozzt ***@***.***>
Date: Thu,Mar 14,2024 4:38 PM
To: openvinotoolkit/anomalib ***@***.***>
Cc: praycxy ***@***.***>, Author ***@***.***>
Subject: Re: [openvinotoolkit/anomalib] There is a bug in the data used totrain the padim model, and the image path cannot be found, and I don't knowwhat the problem is (Discussion #1854)
我遇到了同样的问题,我把数据集删掉一部分解决了,但是又出现了新的问题,提示图像size不对,你试试吧,1.0bug有点多我感觉
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
您好,我已经解决了训练的问题,在减少了数据集数量后,使用padim 模型可以训练出来结果!虽然结果很差,但我认为是自身数据集有问题,后续我再调整修改。关于您的数据size问题,我的数据集是512,MVTec官方代码图像大小是900,不知道您的数据集大小是多少,我之前也怀疑过自己的问题是数据集大小,所以查阅大量资料后发现数据集大小必须大于256,不能太小也不能太大,一千多像素的图像尺寸也不可行(一些博客资料显示),您可以查看一下自己的图像大小,希望对您有所帮助。
Covi
***@***.***
…------------------ Original ------------------
From: zhaozzt ***@***.***>
Date: Thu,Mar 14,2024 4:39 PM
To: openvinotoolkit/anomalib ***@***.***>
Cc: praycxy ***@***.***>, Author ***@***.***>
Subject: Re: [openvinotoolkit/anomalib] There is a bug in the data used totrain the padim model, and the image path cannot be found, and I don't knowwhat the problem is (Discussion #1854)
如果你解决了问题,还请分享一下
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
) (.venv) PS C:\patch\anomalib> python tools/train.py --config C:\patch\anomalib\anomalib\models\padim\config.yaml C:\patch\anomalib\src\anomalib\config\config.py:280: UserWarning: config.project.unique_dir is set to False. This does not ensure that your results will be written in an empty directory and you may overwrite files. warn( Global seed set to 42 2024-03-14 14:46:49,033 - anomalib.data - INFO - Loading the datamodule 2024-03-14 14:46:49,034 - anomalib.data.utils.transform - INFO - No config file has been provided. Using default transforms. 2024-03-14 14:46:49,035 - anomalib.data.utils.transform - INFO - No config file has been provided. Using default transforms. 2024-03-14 14:46:49,035 - anomalib.models - INFO - Loading the model. 2024-03-14 14:46:49,036 - anomalib.models.components.base.anomaly_module - INFO - Initializing PadimLightning model. C:\patch\anomalib\.venv\Lib\site-packages\torchmetrics\utilities\prints.py:36: UserWarning: Metric
PrecisionRecallCurvewill save all targets and predictions in buffer. For large datasets this may lead to large memory footprint. warnings.warn(*args, **kwargs) 2024-03-14 14:46:49,041 - anomalib.models.components.feature_extractors.timm - WARNING - FeatureExtractor is deprecated. Use TimmFeatureExtractor in stead. Both FeatureExtractor and TimmFeatureExtractor will be removed in a future release. 2024-03-14 14:46:49,338 - timm.models.helpers - INFO - Loading pretrained weights from url (https://download.pytorch.org/models/resnet18-5c106cde.pt h) 2024-03-14 14:46:49,540 - anomalib.utils.loggers - INFO - Loading the experiment logger(s) 2024-03-14 14:46:49,540 - anomalib.utils.callbacks - INFO - Loading the callbacks 2024-03-14 14:46:49,543 - anomalib.utils.callbacks - INFO - Setting model export to onnx 2024-03-14 14:46:49,552 - pytorch_lightning.utilities.rank_zero - INFO - GPU available: False, used: False 2024-03-14 14:46:49,554 - pytorch_lightning.utilities.rank_zero - INFO - TPU available: False, using: 0 TPU cores 2024-03-14 14:46:49,554 - pytorch_lightning.utilities.rank_zero - INFO - IPU available: False, using: 0 IPUs 2024-03-14 14:46:49,554 - pytorch_lightning.utilities.rank_zero - INFO - HPU available: False, using: 0 HPUs 2024-03-14 14:46:49,554 - pytorch_lightning.utilities.rank_zero - INFO -
Trainer(limit_train_batches=1.0)was configured so 100% of the batches pe r epoch will be used.. 2024-03-14 14:46:49,554 - pytorch_lightning.utilities.rank_zero - INFO -
Trainer(limit_val_batches=1.0)was configured so 100% of the batches will be used.. 2024-03-14 14:46:49,554 - pytorch_lightning.utilities.rank_zero - INFO -
Trainer(limit_test_batches=1.0)was configured so 100% of the batches wil l be used.. 2024-03-14 14:46:49,555 - pytorch_lightning.utilities.rank_zero - INFO -
Trainer(limit_predict_batches=1.0)was configured so 100% of the batches will be used.. 2024-03-14 14:46:49,555 - pytorch_lightning.utilities.rank_zero - INFO -
Trainer(val_check_interval=1.0)was configured so validation will run at the end of the training epoch.. 2024-03-14 14:46:49,555 - anomalib - INFO - Training the model. Traceback (most recent call last): File "C:\patch\anomalib\tools\train.py", line 86, in <module> train(args) File "C:\patch\anomalib\tools\train.py", line 71, in train trainer.fit(model=model, datamodule=datamodule) File "C:\patch\anomalib\.venv\Lib\site-packages\pytorch_lightning\trainer\trainer.py", line 608, in fit call._call_and_handle_interrupt( File "C:\patch\anomalib\.venv\Lib\site-packages\pytorch_lightning\trainer\call.py", line 38, in _call_and_handle_interrupt return trainer_fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\patch\anomalib\.venv\Lib\site-packages\pytorch_lightning\trainer\trainer.py", line 650, in _fit_impl self._run(model, ckpt_path=self.ckpt_path) File "C:\patch\anomalib\.venv\Lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1051, in _run self._call_setup_hook() # allow user to setup lightning_module in accelerator environment ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\patch\anomalib\.venv\Lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1298, in _call_setup_hook self._call_lightning_datamodule_hook("setup", stage=fn) File "C:\patch\anomalib\.venv\Lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1375, in _call_lightning_datamodule_hook return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "C:\patch\anomalib\src\anomalib\data\base\datamodule.py", line 111, in setup self._setup(stage) File "C:\patch\anomalib\src\anomalib\data\base\datamodule.py", line 127, in _setup self.train_data.setup() File "C:\patch\anomalib\src\anomalib\data\base\dataset.py", line 162, in setup self._setup() File "C:\patch\anomalib\src\anomalib\data\folder.py", line 200, in _setup return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "C:\patch\anomalib\src\anomalib\data\base\datamodule.py", line 111, in setup self._setup(stage) File "C:\patch\anomalib\src\anomalib\data\base\datamodule.py", line 127, in _setup self.train_data.setup() File "C:\patch\anomalib\src\anomalib\data\base\dataset.py", line 162, in setup self._setup() File "C:\patch\anomalib\src\anomalib\data\folder.py", line 200, in _setup self.samples = make_folder_dataset( ^^^^^^^^^^^^^^^^^^^^ File "C:\patch\anomalib\src\anomalib\data\folder.py", line 97, in make_folder_dataset filename, label = _prepare_files_labels(path, dir_type, extensions) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\patch\anomalib\src\anomalib\data\utils\path.py", line 67, in _prepare_files_labels raise RuntimeError(f"Found 0 {path_type} images in {path}") RuntimeError: Found 0 DirType.MASK images in C:\patch\anomalib\datasets\MVTec\bottle\datasets\MVTec\bottle
`dataset:
name: mydatas # 数据集的名字,如MVTec等,这个不重要
format: folder
path: C:/patch/anomalib/datasets/mydatas/bottle # 自制数据集路径
normal_dir: /train/good # 自制数据集正样本子文件夹
abnormal_dir: /test/neglect # 自制数据集负样本子文件夹
mask_dir: /ground_truth/neglect # 二值掩膜路径,自制数据集一般没有,填null
normal_test_dir: /test/good # 包含正常测试图像的文件夹的名称。
task: segmentation # classification or segmentation
extensions: null
normalization: imagenet # 此处添加imagenet
split_ratio: 0.2 # ratio of the normal images that will be used to create a test split
image_size: 256
train_batch_size: 32
test_batch_size: 32
num_workers: 8
transform_config:
train: null
val: null
test_split_mode: from_dir # 此处添加
test_split_ratio: 0.2
val_split_mode: same_as_test
val_split_ratio: 0.5
create_validation_set: true
tiling:
apply: false
tile_size: null
stride: null
remove_border_count: 0
use_random_tiling: False
random_tile_count: 16
model:
name: padim
backbone: resnet18
pre_trained: true
layers:
- layer1
- layer2
- layer3
normalization_method: min_max # options: [none, min_max, cdf]
`
Is there a problem with my data path?
Beta Was this translation helpful? Give feedback.
All reactions