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.
[x] Extract patches for images in a single folder
[x] Extract patches of images from multiple sources (datasets) with various ratio of Train/Validation data split.
[x] Enable multiprocessing
[ ] Use TIAToolbox for patches extraction to support scaling and marginal patches
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 arepatch_extraction_single.py
andpatch_extraction_mutiple.py
which take care of processing a single folder or multiple folders dataset in multiprocessing way.