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.

TypeError: forward_train() missing 2 required positional arguments: 'gt_bboxes' and 'gt_labels'

See original GitHub issue

When I use config to train my own data, workflow is set to [(‘train’, 1)] and the training runs normally. When workflow is set to [(‘train’, 1),(‘val’, 1)], val reports the following error: File "/media/nnir712/F264A15264A119FD/zzh/detect/mmcv/mmcv/runner/runner.py", line 265, in train [0/1828] self.model, data_batch, train_mode=True, **kwargs) File "/media/nnir712/F264A15264A119FD/zzh/detect/mmdetection/mmdet/apis/train.py", line 38, in batch_processor losses = model(**data) File "/home/nnir712/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__ result = self.forward(*input, **kwargs) File "/home/nnir712/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 151, in forward return self.module(*inputs[0], **kwargs[0]) File "/home/nnir712/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__ result = self.forward(*input, **kwargs) File "/media/nnir712/F264A15264A119FD/zzh/detect/mmdetection/mmdet/core/fp16/decorators.py", line 49, in new_func return old_func(*args, **kwargs) File "/media/nnir712/F264A15264A119FD/zzh/detect/mmdetection/mmdet/models/detectors/base.py", line 86, in forward return self.forward_train(img, img_meta, **kwargs) TypeError: forward_train() missing 2 required positional arguments: 'gt_bboxes' and 'gt_labels'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21 (2 by maintainers)

github_iconTop GitHub Comments

18reactions
hznuhisejeffreycommented, Oct 10, 2019

perhaps reduce learn rate will solve your problem

9reactions
yhcao6commented, Oct 28, 2019

Thanks for reporting the bug.

There is no gt in test_pipeline which leads this error. Here is a temporary solution:

  1. Add a val_pipiline in the config:
val_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
    dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
    dict(type='RandomFlip', flip_ratio=0.0),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='Pad', size_divisor=32),
    dict(type='DefaultFormatBundle'),
    dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']),
]
  1. Modify data.val.pipeline:
pipeline=val_pipeline,

https://github.com/open-mmlab/mmdetection/blob/82c533bee0de1a84f5959e257815eb7df4e69162/configs/mask_rcnn_r50_fpn_1x.py#L156

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: missing 2 required positional arguments - Stack Overflow
I tried entering print(user_win(player, opponent)) inside def script() and then I got the error that "player" and "opponent" are not defined. So ...
Read more >
Function() missing 2 required positional arguments - Python
TypeError : function() missing 2 required positional arguments: 'city1' ... to have function() , you could eliminate the parameters, and have
Read more >
TypeError: forward() missing 2 required positional arguments
Hello,. I am using the following code from hgraph2graph and I am getting an error message for missing arguments.
Read more >
Feeding PipelineData to HyperDriveStep results in: TypeError ...
Feeding PipelineData to HyperDriveStep results in: TypeError: __new__() missing 2 required positional arguments: 'workspace' and 'name'.
Read more >
doInOrden() missing 2 required positional arguments: 'probe ...
For me not much experience just run some code have face the error required two positional arguments probe and visit please help me...
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