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

errors on training custom instance segmentation dataset #26

Open
kklots opened this issue Oct 12, 2021 · 2 comments
Open

errors on training custom instance segmentation dataset #26

kklots opened this issue Oct 12, 2021 · 2 comments

Comments

@kklots
Copy link

kklots commented Oct 12, 2021

I have prepared a custom instance segmentation dataset, which contains 5 classes (not counting background). It worked fine on original MMDetection framework training (such as: detectoRS, mask-RCNN, HTC), but when I modified file lsnet_segm_r50_fpn_1x_coco.py to train on this dataset, the system report errors:

File "/data2/lixuan/workspace/LSNet/code/mmdet/models/dense_heads/lsnet_head.py", line 1299, in loss
gt_polygons, gt_bboxes = self.process_polygons(gt_masks, cls_scores)
File "/data2/lixuan/workspace/LSNet/code/mmdet/models/dense_heads/lsnet_head.py", line 1742, in process_polygons
gt_polygons_stack = torch.stack(gt_polygons)
RuntimeError: stack expects a non-empty TensorList

I checked file lsnet_head.py, and found that the gt_masks is empty:

def forward_train(self,
                  x,
                  img_metas,
                  gt_bboxes,
                  gt_extremes = None,
                  gt_keypoints = None,
                  gt_masks = None,
                  gt_labels = None,
                  gt_bboxes_ignore=None,
                  proposal_cfg = None,
                  **kwargs):
    outs = self(x)
    print(gt_masks)
    input()

results:
[PolygonMasks(num_masks=0, height=800, width=1088)]

what causes this error and how can I solve it.

@kklots kklots changed the title errors on training custom instance segmentation model task errors on training custom instance segmentation dataset Oct 13, 2021
@Duankaiwen
Copy link
Owner

@kklots add coco_lsvr.py to code/configs/base/datasets, modify coco.py at code/mmdet/datasets and loading.py and transforms.py at code/mmdet/datasets/pipelines

@dongdongyee
Copy link

Maybe you forgot to modify the CLASSES in coco.py at code/mmdet/datasets. You must comment the 80 classes and add your own classes.

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

No branches or pull requests

3 participants