Traceback (most recent call last):
File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/train.py", line 49, in
main(args)
File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/train.py", line 36, in main
solver.fit()
File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/../src/solver/det_solver.py", line 37, in fit
train_stats = train_one_epoch(
File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/../src/solver/det_engine.py", line 35, in train_one_epoch
for samples, targets in metric_logger.log_every(data_loader, print_freq, header):
File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/../src/misc/logger.py", line 215, in log_every
for obj in iterable:
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 633, in next
data = self._next_data()
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 677, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/media/s304/Data/anaconda3/envs/detr/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 "/media/s304/Data/anaconda3/envs/detr/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 "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/../src/data/coco/coco_dataset.py", line 54, in getitem
img, target = self._transforms(img, target)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, *kwargs)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_container.py", line 51, in forward
sample = transform(sample)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(args, **kwargs)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_transform.py", line 44, in forward
flat_outputs = [
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_transform.py", line 45, in
self._transform(inpt, params) if needs_transform else inpt
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_color.py", line 273, in _transform
inpt = self._permute_channels(inpt, permutation=params["channel_permutation"])
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_color.py", line 249, in _permute_channels
inpt = F.pil_to_tensor(inpt)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/functional.py", line 207, in pil_to_tensor
img = torch.as_tensor(np.array(pic, copy=True))
RuntimeError: Could not infer dtype of numpy.uint8
在训练自定义的数据集的时候,为什么要出现以下错误呢,是python版本不对吗
Traceback (most recent call last): File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/train.py", line 49, in
main(args)
File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/train.py", line 36, in main
solver.fit()
File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/../src/solver/det_solver.py", line 37, in fit
train_stats = train_one_epoch(
File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/../src/solver/det_engine.py", line 35, in train_one_epoch
for samples, targets in metric_logger.log_every(data_loader, print_freq, header):
File "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/../src/misc/logger.py", line 215, in log_every
for obj in iterable:
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 633, in next
data = self._next_data()
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 677, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/media/s304/Data/anaconda3/envs/detr/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 "/media/s304/Data/anaconda3/envs/detr/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 "/media/s304/Data/jjw/RT-DETR-main/rtdetr_pytorch/tools/../src/data/coco/coco_dataset.py", line 54, in getitem
img, target = self._transforms(img, target)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, *kwargs)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_container.py", line 51, in forward
sample = transform(sample)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(args, **kwargs)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_transform.py", line 44, in forward
flat_outputs = [
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_transform.py", line 45, in
self._transform(inpt, params) if needs_transform else inpt
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_color.py", line 273, in _transform
inpt = self._permute_channels(inpt, permutation=params["channel_permutation"])
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/v2/_color.py", line 249, in _permute_channels
inpt = F.pil_to_tensor(inpt)
File "/media/s304/Data/anaconda3/envs/detr/lib/python3.9/site-packages/torchvision/transforms/functional.py", line 207, in pil_to_tensor
img = torch.as_tensor(np.array(pic, copy=True))
RuntimeError: Could not infer dtype of numpy.uint8