Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行出现bug 这么解决 #133

Open
4 tasks done
sharp-xiang opened this issue Jan 27, 2024 · 1 comment
Open
4 tasks done

运行出现bug 这么解决 #133

sharp-xiang opened this issue Jan 27, 2024 · 1 comment
Labels
question Further information is requested

Comments

@sharp-xiang
Copy link

Before Asking

  • I have read the README carefully. 我已经仔细阅读了README上的操作指引。

  • I want to train my custom dataset, and I have read the tutorials for finetune on your data carefully and organize my dataset correctly; 我想训练自定义数据集,我已经仔细阅读了训练自定义数据的教程,以及按照正确的目录结构存放数据集。

  • I have pulled the latest code of main branch to run again and the problem still existed. 我已经拉取了主分支上最新的代码,重新运行之后,问题仍不能解决。

Search before asking

  • I have searched the DAMO-YOLO issues and found no similar questions.

Question

[Bug]: TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/data/Disk_B/minrui/anaconda3/envs/mmdetection/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "/data/Disk_B/minrui/anaconda3/envs/mmdetection/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 "/data/Disk_B/minrui/anaconda3/envs/mmdetection/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/data/Disk_B/minrui/DAMO-YOLO-master/damo/dataset/datasets/mosaic_wrapper.py", line 226, in getitem img, labels, segments, img_id = self._dataset.pull_item(idx) File "/data/Disk_B/minrui/DAMO-YOLO-master/damo/dataset/datasets/coco.py", line 97, in pull_item obj_mask += mask TypeError: 'int' object is not iterable

Additional

image

@sharp-xiang sharp-xiang added the question Further information is requested label Jan 27, 2024
@ksv87
Copy link

ksv87 commented Mar 29, 2024

make sure that the files are instances_train 2017.json and instances_val2017.json segmentation tags are set to [] (not int) or fix the code here:

obj_masks = []
for obj in anno:
obj_mask = []
if 'segmentation' in obj:
for mask in obj['segmentation']:
obj_mask += mask
if len(obj_mask) > 0:
obj_masks.append(obj_mask)
seg_masks = [
np.array(obj_mask, dtype=np.float32).reshape(-1, 2)
for obj_mask in obj_masks
]

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants