shinya7y / UniverseNet

USB: Universal-Scale Object Detection Benchmark (BMVC 2022)
Apache License 2.0
422 stars 54 forks source link

when use model inference, RuntimeError: input image is smaller than kernel.How can I solve the error? #3

Closed chenzyhust closed 4 years ago

chenzyhust commented 4 years ago

Thanks for your error report and we appreciate it a lot.

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. The bug has not been fixed in the latest version.

Describe the bug A clear and concise description of what the bug is.

Reproduction

  1. What command or script did you run?
    A placeholder for the command.
  2. Did you make any modifications on the code or config? Did you understand what you have modified?
  3. What dataset did you use?

Environment

  1. Please run python mmdet/utils/collect_env.py to collect necessary environment information and paste it here.
  2. You may add addition that may be helpful for locating the problem, such as
    • How you installed PyTorch [e.g., pip, conda, source]
    • Other environment variables that may be related (such as $PATH, $LD_LIBRARY_PATH, $PYTHONPATH, etc.)

Error traceback If applicable, paste the error trackback here.

A placeholder for trackback.

Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

shinya7y commented 4 years ago

What config did you use? Using configs and models for UniverseNet+GFL may solve the error, because lcconv_padding=1 is set.

chenzyhust commented 4 years ago

Thank you for your reply.The config is: model = dict( type='GFL', pretrained=None, backbone=dict( type='Res2Net', depth=101, scales=4, base_width=26, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch', dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False), stage_with_dcn=(False, True, True, True)), neck=[ dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, start_level=1, add_extra_convs='on_output', num_outs=5), dict( type='SEPC', out_channels=256, stacked_convs=4, pconv_deform=True, lcconv_deform=True, ibn=False, lcconv_padding=1) ], bbox_head=dict( type='GFLSEPCHead', num_classes=10, in_channels=256, stacked_convs=0, feat_channels=256, anchor_generator=dict( type='AnchorGenerator', ratios=[1.0], octave_base_scale=8, scales_per_octave=1, strides=[8, 16, 32, 64, 128]), loss_cls=dict( type='QualityFocalLoss', use_sigmoid=True, beta=2.0, loss_weight=1.0), loss_dfl=dict(type='DistributionFocalLoss', loss_weight=0.25), reg_max=16, loss_bbox=dict(type='GIoULoss', loss_weight=2.0)))

shinya7y commented 4 years ago

It seems different from an error I encountered. Could you provide Error traceback and your whole config?

num_classes=10, If the dataset is non-public, error reproduction is generally difficult.

shinya7y commented 4 years ago

If the error doesn't occur in training, some images in val/test dataset may have large aspect ratios. Shorter side pixels of such images become small after resizing.

chenzyhust commented 4 years ago

Yes, the error doesn't occur in training.If my dataset have large aspect rations, can I set a size with large aspect ration such as (1600, 800) to solve the error?

shinya7y commented 4 years ago

It's worth trying with larger and larger img_scale. If the error still occurs, it may be better to consider removing images having too high aspect ratios.

shinya7y commented 4 years ago

The latest code of master branch supports small input images (shorter side pixels >= 96).