mostafajahanifar / nuclick_torch

Pytorch implementation of NuClick for interactive cell segmentation
26 stars 7 forks source link

Patchextraction #3

Closed mostafajahanifar closed 2 years ago

mostafajahanifar commented 2 years ago

In order to make the NuClick training process as fast as possible, it's better to extract NuClick related patches from the original images/mask beforehand. A good practice is to have small patches extracted offline (beforehand) alongside the masks of desired and other objects (two different mask) in that patch and save all the information in a single file for each patch. Doing so, we can design our NuClickDataset class to read these patches (instead of the original images and masks) and generate guiding signals on-the-fly.

Therefore, in this PR I have introduced some functions and code snippets for patch extraction which support multiprocessing for faster results. The main function data.patch_extractor.patch_extract_save process a single image and its mask to generate small patches based on the number of nuclei present in the image's mask. Other two main code snippets are patch_extraction_single.py and patch_extraction_mutiple.py which take care of processing a single folder or multiple folders dataset in multiprocessing way.