cqylunlun / GLASS

[ECCV 2024] Official Implementation and Dataset Release for <A Unified Anomaly Synthesis Strategy with Gradient Ascent for Industrial Anomaly Detection and Localization>
MIT License
156 stars 19 forks source link

显示错误: ValueError: 'a' cannot be empty unless no samples are taken #5

Closed mostimali closed 3 months ago

mostimali commented 3 months ago

Traceback (most recent call last): File "/root/GLASS/GLASS-main/main.py", line 351, in main() File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/click/core.py", line 1720, in invoke return _process_result(rv) File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/click/core.py", line 1657, in _process_result value = ctx.invoke(self._result_callback, value, ctx.params) File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) File "/root/GLASS/GLASS-main/main.py", line 299, in run flag = GLASS.trainer(dataloaders["training"], dataloaders["testing"], dataset_name) File "/root/GLASS/GLASS-main/glass.py", line 233, in trainer for i, data in enumerate(training_data): File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 630, in next data = self._next_data() File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1345, in _next_data return self._process_data(data) File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1371, in _process_data data.reraise() File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/torch/_utils.py", line 694, in reraise raise exception ValueError: Caught ValueError in DataLoader worker process 0. Original Traceback (most recent call last): File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop data = fetcher.fetch(index) File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/miniconda3/envs/glass_env/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 51, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/GLASS/GLASS-main/datasets/mvtec.py", line 169, in getitem aug = PIL.Image.open(np.random.choice(self.anomaly_source_paths)).convert("RGB") File "numpy/random/mtrand.pyx", line 951, in numpy.random.mtrand.RandomState.choice ValueError: 'a' cannot be empty unless no samples are taken 请问这个错误该怎么解决

cqylunlun commented 3 months ago

参考#2,请下载纹理数据集DTD,并正确配置--augpath

mostimali commented 3 months ago

好的, 十分感谢