DevoLearn / devolearn

Accelerate data driven research on embryos with deep learning models :microscope:
MIT License
43 stars 31 forks source link

devolearn/lineage_population_model: add postprocessing algorithm #54

Closed Mainakdeb closed 3 years ago

Mainakdeb commented 3 years ago

non_postprocess_nb postprocess_nb

ABD-01 commented 3 years ago

Hi! I think the function postprocess_preds function can be improved further by using boolean indices like this :

def postprocess_preds(self, preds):
    """
    Args:
        preds (numpy.ndarray): array that needs to be postprocessed.
    """
    for i in range(1, len(preds)):
        mask = preds[i] <= preds[i-1]
        preds[i][mask] = preds[i-1][mask] 

    return(preds)

Analysis (on 1000x1000 np.ndarray): image

Mayukhdeb commented 3 years ago

Interesting, can you provide us with the benchmarks which shows the speedup in devolearn ? You can make the modifications in your own fork and test it out on colab.

cc: @Mainakdeb

Mainakdeb commented 3 years ago

Interesting, can you provide us with the benchmarks which shows the speedup in devolearn ? You can make the modifications in your own fork and test it out on colab.

cc: @Mainakdeb

Hi, I tried out the new post-processing function suggested by @ABD-01 on a sample video. Seems like this technique works well for higher dimensional numpy ndarays, but the difference is barely noticeable in the arrays we are working with.

Screenshot from 2021-04-06 02-19-08

Screenshot from 2021-04-06 02-19-28

cc: @Mayukhdeb