acia.segm.processor.predict#

Helper file to generate contours from masks

acia.segm.processor.predict.contour_from_mask(mask, score_threshold)[source]#

Estimate largest contour from pixel-wise mask

acia.segm.processor.predict.prepare_contours(segm_result, labels, offset_x=0, offset_y=0, seg_score_threshold=0.3)[source]#
acia.segm.processor.predict.postprocess(output_data, model, offset_x=0, offset_y=0, contours=False)[source]#
acia.segm.processor.predict.tile_touch_filter(detection, image_tile_poly, threshold=10)[source]#

returns False iff detections it too close (<threshold) to the boundaries and likely to be restricted by them

detection: the detection dict image_tile_poly: Line string of the image tile boundaries threshold: minimum allowed distance to the boundaries

Parameters:

image_tile_poly (LineString)

acia.segm.processor.predict.inference(image, model, offset_x=0, offset_y=0)[source]#
acia.segm.processor.predict.tiled_inference(image, model, x_shift=128, y_shift=128, tile_width=256, tile_height=256, pd=25)[source]#

Execute inference in a tiled fashion

x_shift: shift on the x-axis for every image slot y_shift: shift on the y-axis for every image slot tile_width: width of the image tile tile_height: height of the image tile

TODO: When tiles align with image borders, we should not do tile touch filtering

acia.segm.processor.predict.non_max_supression(all_detections, iou=0.3)[source]#

Performing something like non-maximum supression on a list of detections

TODO: make sure that this corresponds with some paper for nms

all_detections: all detections found in an image iou: intersection over union: if a poly intersects more than that with another poly and it’s score is lower it gets discarded.

returns the filtered list of detections

Parameters:

all_detections (list[Polygon])

acia.segm.processor.predict.np_vec_no_jit_iou(boxes1, boxes2)[source]#
acia.segm.processor.predict.torch_vec_no_jit_iou(boxes1, boxes2)[source]#
acia.segm.processor.predict.torch_mask_nms(masks, bboxes, scores, bbox_iou_threshold=0.1, mask_iou_threshold=0.4, score_threshold=0.1)[source]#

iou: if intersection between two cells is larger, only take the better scored one

acia.segm.processor.predict.mask_nms(masks, bboxes, scores, bbox_iou_threshold=0.1, mask_iou_threshold=0.4, score_threshold=0.1)[source]#

iou: if intersection between two cells is larger, only take the better scored one

acia.segm.processor.predict.prediction(image, model, min_score=0.0, tiling=None)[source]#