randomPatchExtractionDatastore
Datastore for extracting random 2-D or 3-D random patches from images or pixel label images
Description
A randomPatchExtractionDatastore
object extracts corresponding
randomly-positioned patches from two image-based datastores. For example, the input datastores
can be two image datastores that contain the network inputs and desired network responses for
training image-to-image regression networks, or ground truth images and pixel label data for
training semantic segmentation networks.
This object requires that you have Deep Learning Toolbox™.
Note
When you use a randomPatchExtractionDatastore
as a source of training
data, the datastore extracts multiple random patches from each image for each epoch, so that
each epoch uses a slightly different data set. The actual number of training patches at each
epoch is the number of training images multiplied by PatchesPerImage
. The image patches are not stored in memory.
Creation
Syntax
Description
patchds = randomPatchExtractionDatastore(
uses name-value arguments to set the ds1
,ds2
,PatchSize
,Name,Value
)PatchesPerImage
, DataAugmentation
, and DispatchInBackground
properties. You can specify multiple
name-value arguments.
For example,
randomPatchExtractionDatastore(imds1,imds2,50,"PatchesPerImage",40)
creates a datastore that randomly generates 40 patches of size 50-by-50 pixels from each
image in image datastores imds1
and imds2
.
Input Arguments
Properties
Object Functions
combine | Combine data from multiple datastores |
hasdata | Determine if data is available to read |
numpartitions | Number of datastore partitions |
partition | Partition a datastore |
partitionByIndex | Partition randomPatchExtractionDatastore according to
indices |
preview | Preview subset of data in datastore |
read | Read data from randomPatchExtractionDatastore |
readall | Read all data in datastore |
readByIndex | Read data specified by index from
randomPatchExtractionDatastore |
reset | Reset datastore to initial state |
shuffle | Shuffle data in datastore |
transform | Transform datastore |
isPartitionable | Determine whether datastore is partitionable |
isShuffleable | Determine whether datastore is shuffleable |
Examples
Tips
The
randomPatchExtractionDatastore
expects that the output from theread
operation on the input datastores return arrays of the same size.If the input datastore is an
ImageDatastore
, then the values in itsLabels
property are ignored by therandomPatchExtractionDatastore
.To visualize 2-D data in a
randomPatchExtractionDatastore
, you can use thepreview
function, which returns a subset of data in a table. Visualize all of the patches in the same figure by using themontage
function. For example, this code displays a preview of image patches from arandomPatchExtractionDatastore
calledpatchds
.minibatch = preview(patchds); montage(minibatch.InputImage)
Version History
Introduced in R2018b
See Also
augmentedImageDatastore
(Deep Learning Toolbox) | pixelLabelDatastore
(Computer Vision Toolbox) | imageDatastore
| trainNetwork
(Deep Learning Toolbox) | imageDataAugmenter
(Deep Learning Toolbox) | TransformedDatastore
Topics
- Increase Image Resolution Using Deep Learning
- JPEG Image Deblocking Using Deep Learning
- Image Processing Operator Approximation Using Deep Learning
- Semantic Segmentation of Multispectral Images Using Deep Learning
- Datastores for Deep Learning (Deep Learning Toolbox)
- Preprocess Images for Deep Learning (Deep Learning Toolbox)
- Deep Learning in MATLAB (Deep Learning Toolbox)