Skip to content

btad的运行测试 #6

@yffbk

Description

@yffbk

作者你好,train_btad.py运行不成功,和datasets/btad.py中anomaly_sourec_path=r'D:\AMI-Net-main\data\nature'是否有关系?nature是什么数据集?希望得到作者解答,感谢
报错:
01 AMAE 4 8 0.5 8 1
D:\yolov5-3.1\venv\ami_env\lib\site-packages\torchvision\transforms\transforms.py:257: UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum.
warnings.warn(
0%| | 0/50 [00:00<?, ?it/s]
Traceback (most recent call last):
File "D:/mcy/AMI-Net-main/train_btad.py", line 392, in
model.train()
File "D:/mcy/AMI-Net-main/train_btad.py", line 84, in train
for index, (x, _, _, _, arti_x, arti_mask, _) in enumerate(tqdm(self.trainloader, ncols=80)):
File "D:\yolov5-3.1\venv\ami_env\lib\site-packages\tqdm\std.py", line 1195, in iter
for obj in iterable:
File "D:\yolov5-3.1\venv\ami_env\lib\site-packages\torch\utils\data\dataloader.py", line 517, in next
data = self._next_data()
File "D:\yolov5-3.1\venv\ami_env\lib\site-packages\torch\utils\data\dataloader.py", line 557, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\yolov5-3.1\venv\ami_env\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\yolov5-3.1\venv\ami_env\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\mcy\AMI-Net-main\datasets\btad.py", line 119, in getitem
aug_x, aug_mask, aug_label = self.random_anomaly(x)
File "D:\mcy\AMI-Net-main\datasets\btad.py", line 149, in random_anomaly
aug_img, aug_mask, aug_label = self.augment_image(image, self.anomaly_source_paths)
File "D:\mcy\AMI-Net-main\datasets\btad.py", line 76, in augment_image
random_nature_img_name = random.sample(anomaly_source_path, 1)[0]
File "D:\yolov5-3.1\venv\ami_env\lib\random.py", line 363, in sample
raise ValueError("Sample larger than population or is negative")
ValueError: Sample larger than population or is negative

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions