question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AssertionError when training panoptic segmentation head

See original GitHub issue

Hi, thanks again for the work put into this project!

I have trained a object detection model on a custom dataset and now want to train the segmentation head, however I get the following error after a few batches of training:

File "/home/daniel/Work/detr/util/box_ops.py", line 53, in generalized_box_iou
assert (boxes2[:, 2:] >= boxes2[:, :2]).all()
AssertionError
Full traceback
Traceback (most recent call last):
File "main.py", line 307, in <module>
main(args)
File "main.py", line 212, in main
train_stats = train_one_epoch(
File "/home/daniel/Work/detr/engine.py", line 33, in train_one_epoch
loss_dict = criterion(outputs, targets)
File "/home/daniel/.conda/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/daniel/Work/detr/models/detr.py", line 225, in forward
indices = self.matcher(outputs_without_aux, targets)
File "/home/daniel/.conda/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/daniel/.conda/envs/pytorch/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 15, in decorate_context
return func(*args, **kwargs)
File "/home/daniel/Work/detr/models/matcher.py", line 74, in forward
cost_giou = -generalized_box_iou(box_cxcywh_to_xyxy(out_bbox), box_cxcywh_to_xyxy(tgt_bbox))
File "/home/daniel/Work/detr/util/box_ops.py", line 53, in generalized_box_iou
assert (boxes2[:, 2:] >= boxes2[:, :2]).all()
AssertionError

My dataset contains 3 classes and as such I have modified the num_classes, in argparse too. It is consistent with https://github.com/facebookresearch/detr/issues/28#issuecomment-636712413

Any idea of why I’m getting this error?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
DanielFennhagencommented, Sep 23, 2020

The previous error was caused by me, the isthing had been stored as a string.

I can now train the panoptic head. Thank you very much for the help @alcinos & @fmassa!

0reactions
Dicko87commented, Oct 18, 2021

Hi @fmassa, @DanielFennhagen, @alcinos , I am also getting exactly the same ZeroDivisionError and was curious how did you solve this? I made the change outlined above #244 but still getting the error (probably unrelated to the fix). I checked the isthing value and type by using print statements, in my json files my isthing has the value of 1 as an integer for my custom datatset.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial 2: Customize Datasets - MMDetection's documentation!
1. Modify the config file for using the customized dataset · The data field. Specifically, you need to explicitly add the classes fields...
Read more >
train.py - gagan3012/yolov5 - DagsHub
train.py ... getLogger(__name__); def train(hyp, opt, device, tb_writer=None, ... 'true'; except (ImportError, AssertionError):; logger.info("Install ...
Read more >
Panoptic Segmentation: Definition, Datasets & Tutorial [2022]
Panoptic segmentation is the task of simultaneously segmenting objects and classifying them into categories. Discover different approaches to the task.
Read more >
How to train Detectron2 with Custom COCO Datasets - DLology
This tutorial will help you get started with Detectron2 framework by training an instance segmentation model with your custom COCO datasets.
Read more >
mmdet - PyPI
Faster training and testing speed with complete support of mixed precision ... Object Detection, Instance Segmentation, Panoptic Segmentation, Other.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found