StrokeWidthTransform icon indicating copy to clipboard operation
StrokeWidthTransform copied to clipboard

Urgent :memory Error

Open chitransh1998 opened this issue 6 years ago • 4 comments

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

chitransh1998 avatar May 24 '18 08:05 chitransh1998

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

mengxue-rs avatar May 24 '18 12:05 mengxue-rs

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.

chitransh1998 avatar May 24 '18 16:05 chitransh1998

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

mengxue-rs avatar May 25 '18 01:05 mengxue-rs

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

soumyajit700 avatar May 02 '19 11:05 soumyajit700