PaddleDetection icon indicating copy to clipboard operation
PaddleDetection copied to clipboard

RandomExpand

Open rydenisbak opened this issue 2 years ago • 2 comments

问题确认 Search before asking

  • [X] 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

DataProcess

Bug描述 Describe the Bug

I found bug in RandomExpand transform

https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.6/ppdet/data/transform/operators.py#L1184-L1185C1

We need change this lines

 if np.random.uniform(0., 1.) < self.prob:
            return sample

to this

 if np.random.uniform(0., 1.) >= self.prob:
            return sample

复现环境 Environment

do not care

Bug描述确认 Bug description confirmation

  • [X] 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • [ ] 我愿意提交PR!I'd like to help by submitting a PR!

rydenisbak avatar Aug 17 '23 10:08 rydenisbak

thanks,but I think the origin code is right

zhiboniu avatar Mar 04 '24 09:03 zhiboniu

I think rydenisbak is probably right. From what I understand prob is the probability that the image is randomly expanded. The expected behavior is, if I set prob = 0, the image should never be expanded.

With the original code, we get some value between 0 and 1 which will never be les than 0. So we never return the original sample, we always return the expanded sample. This is contrary to the expected behavior.

 if np.random.uniform(0., 1.) < self.prob:
            return sample

Tanmay-Jaiswal avatar Jan 06 '25 06:01 Tanmay-Jaiswal