Simple python script that extract a given number of overlapping patches from a set of images and their corresponding masks (optionally). The script can be run with several input parameters:
--input_imgs_path
: path to images folder [str
- required]--input_masks_path
: path to masks folder [str
- optional]--n_patches
: number of extracted patches per image. IfNone
, the maximum number of patches is extracted [int
- optional].--patch_size
: patch dimensions, i.e.(patch_size, patch_size)
[int
- required]
All the dependencies are detailed in the requirements.txt
file and can be installed with pip
and the following command:
pip3 install -r requirements.txt
The script can be launched as follows:
python3 patch_extractor.py -i samples/ -s 50
Here are two examples of patches extracted from a set if images and their correnspondent masks: