ValueError: Caught ValueError in DataLoader worker process 2. Original Traceback (most recent call last): File "/public/home/ac2ax5rex7/miniconda3/envs/detr/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop data = fetcher.fetch(index) File "/public/home/ac2ax5rex7/miniconda3/envs/detr/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/public/home/ac2ax5rex7/miniconda3/envs/detr/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/public/home/ac2ax5rex7/projects/lift/detr/datasets/coco.py", line 27, in __getitem__ img, target = self.prepare(img, target) File "/public/home/ac2ax5rex7/projects/lift/detr/datasets/coco.py", line 72, in __call__ classes = torch.tensor(classes, dtype=torch.int64) ValueError: too many dimensions 'str' I0608 17:13:06.734618 28355 ProcessGroupNCCL.cpp:603] [Rank 0] NCCL watchdog thread terminated normally
时间: 2023-07-12 21:04:53 浏览: 347
linux 下 pip3 报错“ File “/usr/bin/pip3”, line 9, in from pip import mainImportError: canno”处理
5星 · 资源好评率100%
这个错误通常是因为在数据集的准备中,类别标签的格式出现了问题。在COCO数据集中,标签通常是一个列表,其中每个元素都是一个字典,表示一个目标,其中包括类别、边界框等信息。你需要检查数据集准备的代码,确保标签被正确解析,并且在传递给模型之前被转换为正确的Tensor格式。另外,还需要检查是否有任何错误的字符或格式问题,例如额外的空格或换行符。
阅读全文