Patch Extraction Tools for Deep Learning Data Preparation
A set of tools dedicated to the preparation of data for training Deep Learning models and reducing annotation time.
This Xtra consists of five modules aimed at better control of data preparation for training Deep Learning models, through the extraction of 2D or 3D image patches of a fixed size. Patches can be extracted manually, randomly, or regularly across the input volume, and at repeatable positions.
A slide deck is included, giving some instructions and context for using these modules.
A workflow for focusing manual segmentation of the patches with their 3D context is also presented.
The modules are the following:
RandomLandmarks: can generate random landmarks in the bounding box of the data (or a ROI), using uniform but possibly ‘stratified’ sampling independent in X/Y/Z. The module can also randomize the order of an existing set of landmarks, which could, for instance, have been manually created with the Landmark Editor.
MaskforPatches: generates a binary image, the same size as the input image, which contains value 1 inside patches of fixed size around the input landmarks, and 0 elsewhere. Only full patches are considered: if a landmark is too close to the image boundary, it is not taken into account. This is helpful to visualize the location of the patches, but also to navigate through them in the Segmentation Editor using the ‘next slice’ selection feature, so you may proceed with manual segmentation of these patches while observing the context.
ExtractPatches: extracts the patches of defined size centered around input landmarks, either as an in-memory volume or as a set of 2D TIF images. Only full patches are considered: if a landmark is too close to the image boundary, it is not taken into account. The order of the landmark set defines the order of the slices in the output volume, or the name of the patch file.
ExtractSlices: extracts a fixed number of XY slices, using random uniform stratified sampling, and creates an image out of it. The list of slices is shown, and can be manually copy-pasted as a parameter, or re-used for extracting the same slices in the same order for a second dataset.
ExtractRegularPatches: extracts adjacent patches of fixed size to pile them up. Useful for datasets containing only one or few large slices.
Note for PerGeos users: the modules and tools proposed in this Xtra are available from the Explore workroom. However, some convenience features mentioned in the slides are only available to Amira and Avizo users. The .hx project file can be loaded in PerGeos to illustrate its use.
Illustrations use an SOFC dataset courtesy of Sabanci University, Turkey