Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Fix the AssertionError when calling masker in coco_eval.py #213

Merged
merged 3 commits into from
Nov 27, 2018
Merged

Fix the AssertionError when calling masker in coco_eval.py #213

merged 3 commits into from
Nov 27, 2018

Conversation

henrywang1
Copy link
Contributor

@henrywang1 henrywang1 commented Nov 26, 2018

After applying the changes in #207.
I got the same AssertionError as described in #185 when I executing

python tools/test_net.py --config-file "configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml" TEST.IMS_PER_BATCH 2

It could be fixed by doing the same way as #187 .

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Nov 26, 2018
@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@henrywang1 henrywang1 closed this Nov 26, 2018
@henrywang1 henrywang1 deleted the fix-masker branch November 26, 2018 10:37
@henrywang1
Copy link
Contributor Author

henrywang1 commented Nov 26, 2018

The performance seems to become bad due to pass masks to Masker, so I decide to drop the PR.

@fmassa
Copy link
Contributor

fmassa commented Nov 26, 2018

So the code is not working for you, is that right?

@henrywang1
Copy link
Contributor Author

I got the AssertionError, so I made some changes, and it worked.

But later, I found the performance drops when evaluating the results, so I decided to check it again and cancel the PR.

I think the below command could reproduce the error,

python tools/test_net.py --config-file "configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml" TEST.IMS_PER_BATCH 2

@fmassa
Copy link
Contributor

fmassa commented Nov 26, 2018

I'll investigate this a bit later today, thanks!

@henrywang1 henrywang1 restored the fix-masker branch November 26, 2018 11:38
@fmassa
Copy link
Contributor

fmassa commented Nov 26, 2018

Also, can you tell me what is the AssertionError that you got, just to double check?

@henrywang1
Copy link
Contributor Author

Hi @fmassa
Thanks for your reply.
Here is the AssertionError.

2018-11-26 19:46:20,913 maskrcnn_benchmark.inference INFO: Total inference time: 0:01:23.692130 (0.13390740776062013 s / img per device, on 8 devices)
2018-11-26 19:46:23,992 maskrcnn_benchmark.inference INFO: Preparing results for COCO format
2018-11-26 19:46:23,992 maskrcnn_benchmark.inference INFO: Preparing bbox results
2018-11-26 19:46:24,971 maskrcnn_benchmark.inference INFO: Preparing segm results
0it [00:00, ?it/s]
Traceback (most recent call last):
  File "tools/test_net.py", line 94, in <module>
    main()
  File "tools/test_net.py", line 88, in main
    output_folder=output_folder,
  File "/home/henrywang/github/maskrcnn-benchmark/maskrcnn_benchmark/engine/inference.py", line 104, in inference
    **extra_args)
  File "/home/henrywang/github/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/__init__.py", line 22, in evaluate
    return coco_evaluation(**args)
  File "/home/henrywang/github/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/__init__.py", line 20, in coco_evaluation
    expected_results_sigma_tol=expected_results_sigma_tol,
  File "/home/henrywang/github/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py", line 47, in do_coco_evaluation
    coco_results["segm"] = prepare_for_coco_segmentation(predictions, dataset)
  File "/home/henrywang/github/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py", line 119, in prepare_for_coco_segmentation
    masks = masker(masks, prediction)
  File "/home/henrywang/github/maskrcnn-benchmark/maskrcnn_benchmark/modeling/roi_heads/mask_head/inference.py", line 185, in __call__
    assert len(boxes) == len(masks), "Masks and boxes should have the same length."
AssertionError: Masks and boxes should have the same length.

@henrywang1
Copy link
Contributor Author

henrywang1 commented Nov 26, 2018

After checking it again, I want to reopen the PR and wait for your review.
The performance is bad because I was testing on some large images. (2048*1024)
and it makes the Masker spending more time.

@henrywang1 henrywang1 reopened this Nov 26, 2018
@fmassa
Copy link
Contributor

fmassa commented Nov 27, 2018

Oh, I just realized where the problem is actually: when I rebased the Pascal commit, I forgot to add this part of the code.

Can you please update your PR with the aforementioned fix, and I'll merge this?

Thanks!

Copy link
Contributor

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fmassa fmassa merged commit ef8a93b into facebookresearch:master Nov 27, 2018
@henrywang1 henrywang1 deleted the fix-masker branch November 27, 2018 10:46
nprasad2021 pushed a commit to nprasad2021/maskrcnn-benchmark that referenced this pull request Jan 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants