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

fix cpu mode with tilesize smaller than image size #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ArchieMeng
Copy link

@ArchieMeng ArchieMeng commented Sep 15, 2022

It was only tested on Linux platform. So, please check if it works on Windows. :) fix #186

The reason why it crashes

  • In the original code, the Mat out_alpha_tile is generated from in_alpha_tile, and in_alpha_tile is extracted from Mat in. However, the destination for alpha channel copy is Mat out, which is a tile Mat without padding. At the same time, Mat in is already padded, which resulted in copying data more than output Mat can hold, which is a out of memory boundaries problem and explains why the refcount of out mat was overwritten.
  • The tilesize of CPU mode used to be 4000, which is way larger than usual images, so that the code was working as intended. However, it was changed to 400 in a past commit, which turn a full image inference into a batch inference, and cause this bug.

@ArchieMeng ArchieMeng changed the title fix cpu mode with tilesize smaller than image size, solve #186 fix cpu mode with tilesize smaller than image size, fix #186 Sep 15, 2022
@ArchieMeng ArchieMeng changed the title fix cpu mode with tilesize smaller than image size, fix #186 fix cpu mode with tilesize smaller than image size Sep 15, 2022
It was only tested on Linux platform. So, please check if it works on Windows. :)

Signed-off-by: ArchieMeng <[email protected]>
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

Successfully merging this pull request may close these issues.

Failed to run by CPU on CentOS7
1 participant