import time


def run_inference(model, image):
    """
    Runs inference on an image using model and returns the mask stack.
    """
    # get results
    start = time.time()
    results = model.detect([image], verbose=1)
    end = time.time()
    #print("Inference took {}".format(end-start))
    r = results[0]
    masks = r['masks']
    #print(masks.shape)
    return masks