-
Notifications
You must be signed in to change notification settings - Fork 615
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
Gridmask Cpu #2582
Gridmask Cpu #2582
Conversation
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
float fx = -sx + y * -sa + x * ca; | ||
float fy = -sy + y * ca + x * sa; | ||
auto m = (fx - floor(fx) >= ratio) || (fy - floor(fy) >= ratio); | ||
for (int c = 0; c < in.shape[2]; c++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what would be the perf gain when C is a template argument and we have a compile time generated variant for 1, 3, 4 and the generic one like here.
@mzient what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gain can be significant.
Signed-off-by: Paweł <[email protected]>
Signed-off-by: Paweł <[email protected]>
!build |
CI MESSAGE: [1978194]: BUILD STARTED |
CI MESSAGE: [1978194]: BUILD PASSED |
Signed-off-by: Paweł <[email protected]>
!build |
CI MESSAGE: [1990925]: BUILD STARTED |
CI MESSAGE: [1990925]: BUILD FAILED |
CI test failed:
Can you check it? |
I managed to reproduce it, the problem seems to be that tile * ratio (the width of black squares) is far from an integer (19.46), which trips up the grid generation (because first it makes an unrotated grid, then it rotates it). I can either improve the grid generation, or choose ratio so that tile * ratio is an integer. What do you think? |
I don't think we can make such assumption in general. How the paper deals with that (or silently ignores the problem)?
I think that would be the preferable way. |
Signed-off-by: Paweł <[email protected]>
Improved mask grid generation, but now it's much slower. I don't know how to make it faster with np or cv. |
Signed-off-by: Paweł <[email protected]>
yield check, results[i], inputs[i], tile, ratio, angle | ||
|
||
def test_cpu_vs_cv_random(): | ||
batch_size = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mentioned in the comment that now the tests are slower. I see that the batch size and number of iterations were doubled, which means the test has 4 times more work to do. If you want to reduce testing time I'd reduce the number of iterations (3 should be enough, I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did, but then i made them fast again (7f268fd), so I brought back the old parameters. I think the time taken by both tests is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It takes 12s, looks good.
!build |
CI MESSAGE: [2007899]: BUILD STARTED |
CI MESSAGE: [2007899]: BUILD PASSED |
Why we need this PR?
What happened in this PR?
JIRA TASK: NA