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

Set custom input resolution #46

Open
susanin1970 opened this issue Sep 5, 2023 · 2 comments
Open

Set custom input resolution #46

susanin1970 opened this issue Sep 5, 2023 · 2 comments

Comments

@susanin1970
Copy link

susanin1970 commented Sep 5, 2023

Hi :)
Thanks for this repo

I have a problem with setting a custom input resolution in YAML config

DATASET:
  TRAIN: path\to\train\txt
  VAL: path\to\test\txt 
  NAMES: path\to\names
MODEL:
  NC: 1
  INPUT_WIDTH: 240
  INPUT_HEIGHT: 240
TRAIN:
  LR: 0.001
  THRESH: 0.25
  WARMUP: true
  BATCH_SIZE: 64
  END_EPOCH: 200
  MILESTIONES:
    - 50
    - 100
    - 150

When I try to train FastestDet with different resolution, not default 352x352 (for example, 240x240), I got RuntimeError:

Load yaml sucess...
<utils.tool.LoadYaml object at 0x00000299198CD8B0>
Initialize params from:./module/shufflenetv2.pth
Traceback (most recent call last):
  File "E:\Repositories\FastestDet\train.py", line 134, in <module>
    model = FastestDet()
  File "E:\Repositories\FastestDet\train.py", line 42, in __init__
    summary(self.model, input_size=(3, self.cfg.input_height, self.cfg.input_width))
  File "C:\Users\Reutov\.anaconda3\envs\experimental_env\lib\site-packages\torchsummary\torchsummary.py", line 72, in summary
    model(*x)
  File "C:\Users\Reutov\.anaconda3\envs\experimental_env\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "E:\Repositories\FastestDet\module\detector.py", line 25, in forward
    P = torch.cat((P1, P2, P3), dim=1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 15 but got size 16 for tensor number 2 in the list.

Shapes of P1, P2 and P3 (240х240): torch.Size([2, 48, 30, 30]) torch.Size([2, 96, 15, 15]) torch.Size([2, 192, 8, 8])
Shapes of P1, P2 and P3 (358x358): torch.Size([2, 48, 44, 44]) torch.Size([2, 96, 22, 22]) torch.Size([2, 192, 11, 11])

I can guess that I need to change the architecture of the backbone network a little bit, but pretrained weights will not to load correctly in this case

How can I to change input resolution for training FastestDet?
Can I to change input resolution of FastestDet in convert to ONNX process?

Thanks in advance :)

@superbayes
Copy link

i know that yolov5 support Dynamic size input

@susanin1970
Copy link
Author

susanin1970 commented Sep 26, 2023

i know that yolov5 support Dynamic size input

That's right, but I dont think, that FastestDet is based on YOLOv5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants