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

Threshold for object detection #52

Closed
Dene33 opened this issue Oct 13, 2019 · 2 comments
Closed

Threshold for object detection #52

Dene33 opened this issue Oct 13, 2019 · 2 comments

Comments

@Dene33
Copy link

Dene33 commented Oct 13, 2019

I used Google Colab tutorial, changed instance segmentation model to object detection like this:

cfg = get_cfg()
cfg.merge_from_file("./detectron2_repo/configs/COCO-Detection/retinanet_R_101_FPN_3x.yaml")
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5  # set threshold for this model
# Find a model from detectron2's model zoo. You can either use the https://dl.fbaipublicfiles.... url, or use the following shorthand
cfg.MODEL.WEIGHTS = "detectron2://COCO-Detection/retinanet_R_101_FPN_3x/138363263/model_final_59f53c.pkl"
predictor = DefaultPredictor(cfg)
outputs = predictor(im)

As you can see cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 but threshold doesn't work:

image

Am I doing something wrong? Thanks.

@ppwwyyxx
Copy link
Contributor

RetinaNet by its definition does not have ROI_HEADS. You need to use cfg.MODEL.RETINANET.SCORE_THRESH_TEST.

The official demo script handles this more properly:

detectron2/demo/demo.py

Lines 23 to 25 in d250fcc

cfg.MODEL.RETINANET.SCORE_THRESH_TEST = args.confidence_threshold
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = args.confidence_threshold
cfg.MODEL.PANOPTIC_FPN.COMBINE.INSTANCES_CONFIDENCE_THRESH = args.confidence_threshold

@Bamil
Copy link

Bamil commented Apr 6, 2020

Hey,
how do I set the threshold for 'tensormask_R_50_FPN_6x.yaml' ?
I tried cfg.MODEL.RETINANET.SCORE_THRESH_TEST = 0.5 and / or cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 with no luck. I can't find any documentation for that.
Thanks

UPDATE: after a closer look at the object returned by get_cfg(), I found out that cfg.MODEL.TENSOR_MASK.SCORE_THRESH_TEST = 0.5 did the job for me.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants