jbwang1997/OBBDetection

coco格式的自定义数据集运行报错

Opened this issue · 2 comments

您好!
我照着你isaid.py 给我自己coco-format的数据集做了修改
在configs/obb/base/dataset/和mmdet/datasets/obb/ 两处位置做了修改

但是结果依然还是报错,

Traceback (most recent call last):
File "tools/train.py", line 153, in
main()
File "tools/train.py", line 149, in main
meta=meta)
File "/data1/huangkaibin/OBBDetection/mmdet/apis/train.py", line 133, in train_detector
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/data1/huangkaibin/anaconda3/envs/obbdetection/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
epoch_runner(data_loaders[i], **kwargs)
File "/data1/huangkaibin/anaconda3/envs/obbdetection/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 47, in train
for i, data_batch in enumerate(self.data_loader):
File "/data1/huangkaibin/anaconda3/envs/obbdetection/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 435, in next
data = self._next_data()
File "/data1/huangkaibin/anaconda3/envs/obbdetection/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1085, in _next_data
return self._process_data(data)
File "/data1/huangkaibin/anaconda3/envs/obbdetection/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1111, in _process_data
data.reraise()
File "/data1/huangkaibin/anaconda3/envs/obbdetection/lib/python3.7/site-packages/torch/_utils.py", line 428, in reraise
raise self.exc_type(msg)
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/data1/huangkaibin/anaconda3/envs/obbdetection/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
data = fetcher.fetch(index)
File "/data1/huangkaibin/anaconda3/envs/obbdetection/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/data1/huangkaibin/anaconda3/envs/obbdetection/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/data1/huangkaibin/OBBDetection/mmdet/datasets/custom.py", line 187, in getitem
data = self.prepare_train_img(idx)
File "/data1/huangkaibin/OBBDetection/mmdet/datasets/custom.py", line 205, in prepare_train_img
ann_info = self.get_ann_info(idx)
File "/data1/huangkaibin/OBBDetection/mmdet/datasets/coco.py", line 70, in get_ann_info
return self._parse_ann_info(self.data_infos[idx], ann_info)
File "/data1/huangkaibin/OBBDetection/mmdet/datasets/coco.py", line 142, in _parse_ann_info
x1, y1, w, h = ann['bbox']
ValueError: too many values to unpack (expected 4)

不知道您有没有遇过同样的问题!

coco格式可能还是有些问题,可以提供一个小的annotation上来。

coco格式可能还是有些问题,可以提供一个小的annotation上来。

那請問如果是自己的數據集,到底要怎麼做呢?