randomPatchExtractionDatastore
Datastore for extracting random 2-D or 3-D random patches from images or pixel label images
Description
一个randomPatchExtractionDatastore
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 arandomPatchExtractionDatastore
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 byPatchesPerImage
. The image patches are not stored in memory.
Creation
Syntax
Description
patchds = randomPatchExtractionDatastore(
uses name-value pairs to set theds1
,ds2
,PatchSize
,Name,Value
)PatchesPerImage
,DataAugmentation
, andDispatchInBackground
properties. You can specify multiple name-value pairs. Enclose each property name in quotes.
For example,randomPatchExtractionDatastore (imds1 imds2 50,”帕特chesPerImage',40)
creates a datastore that randomly generates 40 patches of size 50-by-50 pixels from each image in image datastoresimds1
andimds2
.
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 |
PartitionrandomPatchExtractionDatastore according to indices |
preview |
Preview subset of data in datastore |
read |
Read data fromrandomPatchExtractionDatastore |
readall |
Read all data in datastore |
readByIndex |
Read data specified by index fromrandomPatchExtractionDatastore |
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
(计算机矢量绘图软件n Toolbox)|imageDatastore
|pixelLabelImageDatastore
(计算机矢量绘图软件n Toolbox)|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)