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

Urgent :memory Error #8

Open
chitransh1998 opened this issue May 24, 2018 · 4 comments
Open

Urgent :memory Error #8

chitransh1998 opened this issue May 24, 2018 · 4 comments

Comments

@chitransh1998
Copy link

I am trying to run the code in python.
But,I am getting memory error in executing the 'Union' function.
please help.very urgent
Otherwise please provide alternative implementation of SWT in python.

Thanks

@mengxue-rs
Copy link

Hi, I also meet this question ,and i'm debugging to solve it.

@chitransh1998
Copy link
Author

Okay,Please tell me if you get a solution.
I think the image size is too big to read.
Also there are many more errors in the code it seems and needs modifications.

@mengxue-rs
Copy link

@chitransh1998 See the Outofmemory error Issue. Some one provided the modified code.

@soumyajit700
Copy link

Hi, i am getting memory error when trying to run this code in python. This function manly

def _find_letters(cls, swt, shapes, shape_h, shape_w):
# STEP: Discard shapes that are probably not letters
swts = []
heights = []
widths = []
topleft_pts = []
images = []

    for label,layer in shapes.items():
        (nz_y, nz_x) = (layer[0],layer[1])
        east, west, south, north = max(nz_x), min(nz_x), max(nz_y), min(nz_y)
        width, height = east - west, south - north

        if width < 4 or height < 4:
            continue

        if width / height > 10 or height / width > 10:
            continue

        diameter = math.sqrt(width * width + height * height)
        median_swt = np.median(swt[(nz_y, nz_x)])
        swts.append([math.log(median_swt, 2)])
        heights.append([math.log(height, 2)])
        topleft_pts.append(np.asarray([north, west]))
        widths.append(width)
         
        fulllayer = np.zeros((shape_w, shape_h), dtype=np.uint16)
        for i in range(len(layer[0])):
            fulllayer[layer[0][i], layer[1][i]] = 1
        images.append(fulllayer)

    return swts, heights, widths, topleft_pts, images

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

3 participants