raise self.exc_type(msg) AssertionError: Caught AssertionError in DataLoader worker process 0. Original Traceback (most recent call last): File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop data = fetcher.fetch(index) File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/tmp/pycharm_project_84/datasets/dtu_yao_eval.py", line 88, in getitem imgs.append(self.read_img(img_filename)) File "/tmp/pycharm_project_84/datasets/dtu_yao_eval.py", line 63, in read_img assert np_img.shape[:2] == (1200, 1600) AssertionError
时间: 2023-10-09 18:16:23 浏览: 151
Python使用sys.exc_info()方法获取异常信息
这个错误出现在使用PyTorch的DataLoader时,在一个worker进程中抛出了AssertionError。在这个worker进程中,它尝试从数据集中获取一个元素,但是获取的元素不符合预期,它的维度不是(1200, 1600)。这可能意味着数据集中有一些异常的数据。你可以检查一下数据集中的数据是否都符合预期维度,并且通过try-except语句来捕获AssertionError,以便更好地处理异常情况。
阅读全文