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

Decreased accuracy when training with non-square inputs #48

Open
ghost opened this issue Aug 30, 2023 · 1 comment
Open

Decreased accuracy when training with non-square inputs #48

ghost opened this issue Aug 30, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 30, 2023

Hello, thank you for the great work.

I have conducted training on both rectangular and square size inputs on my custom dataset. However, the average accuracy of the rectangular trained model is significantly lower. Below is the configuration that was used for training & evaluation:

Square TrainReader:

batch_transforms:
    - BatchRandomResize: {target_size: [480, 512, 544, 576, 608, 640, 640, 640, 672, 704, 736, 768, 800], random_size: True, random_interp: True, keep_ratio: False}

Rect TrainReader:

batch_transforms:
    - BatchRandomResize: {target_size: [352, 608], random_size: False, random_interp: True, keep_ratio: False}

Square EvalReader:

EvalReader:
  sample_transforms:
    - Decode: {}
    - Resize: {target_size: [608, 608], keep_ratio: False, interp: 2} # target_size: (h, w)

Rect EvalReader:

EvalReader:
  sample_transforms:
    - Decode: {}
    - Resize: {target_size: [352, 608], keep_ratio: False, interp: 2} # target_size: (h, w)

I've read through #13, but it doesn't seem to be related to training with rectangular inputs. When 'random_size: True,' one of the numbers in the target_size is used for square resizing.
I also tried switching w and h as suggested, but the results were similar.
Could I get any help? I would like to know if there's something I'm doing wrong or if a similar issue has been encountered before.

@lyuwenyu
Copy link
Owner

  1. I think your case is same as 关于数据增强与长方形输入 #13. The target_size: [[800, 960]] is a list including one element [800, 960]. It always random choise same rect size.
  batch_transforms:
    - BatchRandomResize: {target_size: [[800, 960]], random_size: True, random_interp: True, keep_ratio: False}
  1. Perhaps your can try the BatchRandomResize style as 关于数据增强与长方形输入 #13 using latest code, although I think the logic is same.
# reset eval_size
eval_size: [352, 608]

  batch_transforms:
    - BatchRandomResize: {target_size: [[352, 608]], random_size: True, random_interp: True, keep_ratio: False}
    - NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
    - NormalizeBox: {}
    - BboxXYXY2XYWH: {}
    - Permute: {}
  1. Make sure self.inputs['im_shape'] == self.inputs['image'])[2:] in here

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

1 participant