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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anchor generator fails broadcasting #2330

Closed
claverru opened this issue Nov 30, 2020 · 1 comment
Closed

Anchor generator fails broadcasting #2330

claverru opened this issue Nov 30, 2020 · 1 comment

Comments

@claverru
Copy link
Contributor

claverru commented Nov 30, 2020

Instructions To Reproduce the 馃悰 Bug:

Config file like:

  ANCHOR_GENERATOR:
    SIZES: [[[32, 64], [64, 128], [128, 256], [256, 512], [512, 1024]]]
    ASPECT_RATIOS: [[0.5, 1.0, 2.0]]
  RPN:
    IN_FEATURES: ["p2", "p3", "p4", "p5", "p6"]

Log

Traceback (most recent call last):
  File "asbestos/train.py", line 71, in <module>
    args=(args,),
  File "/detectron2_repo/detectron2/engine/launch.py", line 62, in launch
    main_func(*args)
  File "asbestos/train.py", line 36, in main
    trainer = Trainer(cfg)
  File "/detectron2_repo/detectron2/engine/defaults.py", line 282, in __init__
    model = self.build_model(cfg)
  File "/detectron2_repo/detectron2/engine/defaults.py", line 440, in build_model
    model = build_model(cfg)
  File "/detectron2_repo/detectron2/modeling/meta_arch/build.py", line 21, in build_model
    model = META_ARCH_REGISTRY.get(meta_arch)(cfg)
  File "/detectron2_repo/detectron2/config/config.py", line 181, in wrapped
    explicit_args = _get_args_from_config(from_config_func, *args, **kwargs)
  File "/detectron2_repo/detectron2/config/config.py", line 236, in _get_args_from_config
    ret = from_config_func(*args, **kwargs)
  File "/detectron2_repo/detectron2/modeling/meta_arch/rcnn.py", line 78, in from_config
    "proposal_generator": build_proposal_generator(cfg, backbone.output_shape()),
  File "/detectron2_repo/detectron2/modeling/proposal_generator/build.py", line 24, in build_proposal_generator
    return PROPOSAL_GENERATOR_REGISTRY.get(name)(cfg, input_shape)
  File "/detectron2_repo/detectron2/config/config.py", line 181, in wrapped
    explicit_args = _get_args_from_config(from_config_func, *args, **kwargs)
  File "/detectron2_repo/detectron2/config/config.py", line 236, in _get_args_from_config
    ret = from_config_func(*args, **kwargs)
  File "/detectron2_repo/detectron2/modeling/proposal_generator/rpn.py", line 242, in from_config
    ret["anchor_generator"] = build_anchor_generator(cfg, [input_shape[f] for f in in_features])
  File "/detectron2_repo/detectron2/modeling/anchor_generator.py", line 380, in build_anchor_generator
    return ANCHOR_GENERATOR_REGISTRY.get(anchor_generator)(cfg, input_shape)
  File "/detectron2_repo/detectron2/config/config.py", line 182, in wrapped
    init_func(self, **explicit_args)
  File "/detectron2_repo/detectron2/modeling/anchor_generator.py", line 116, in __init__
    self.cell_anchors = self._calculate_anchors(sizes, aspect_ratios)
  File "/detectron2_repo/detectron2/modeling/anchor_generator.py", line 132, in _calculate_anchors
    self.generate_cell_anchors(s, a).float() for s, a in zip(sizes, aspect_ratios)
  File "/detectron2_repo/detectron2/modeling/anchor_generator.py", line 132, in <listcomp>
    self.generate_cell_anchors(s, a).float() for s, a in zip(sizes, aspect_ratios)
  File "/detectron2_repo/detectron2/modeling/anchor_generator.py", line 199, in generate_cell_anchors
    area = size ** 2.0
TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'float'

Expected behavior:

Apply:
[34, 64], [0.5, 1, 2.0], "p2"
[64, 128], [0.5, 1, 2.0], "p3"
etc.

Environment:

Last detectron2 version.

Extra:

If this in intended, then the docs are wrong or not enough specific:
https://detectron2.readthedocs.io/modules/config.html

@claverru
Copy link
Contributor Author

Nevermind, I'm the one bugged.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 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

1 participant