shuffle
对数据存储中的所有数据进行乱序处理
说明
示例
创建 ImageDatastore
对象 imds
。无序排列文件以创建新的数据存储,其中包含按随机顺序排列的相同文件。
imds = imageDatastore(fullfile(matlabroot, 'toolbox', 'matlab', {'demos','imagesci'}),'LabelSource','foldernames','FileExtensions', {'.jpg', '.png', '.tif'})
imds = ImageDatastore with properties: Files: { ' ...\matlab\toolbox\matlab\demos\cloudCombined.jpg'; ' ...\matlab\toolbox\matlab\demos\example.tif'; ' ...\matlab\toolbox\matlab\demos\landOcean.jpg' ... and 5 more } Labels: [demos; demos; demos ... and 5 more categorical] ReadFcn: @readDatastoreImage
imdsrand = shuffle(imds)
imdsrand = ImageDatastore with properties: Files: { ' ...\matlab\toolbox\matlab\demos\street2.jpg'; ' ...\matlab\toolbox\matlab\demos\landOcean.jpg'; ' ...\matlab\toolbox\matlab\imagesci\corn.tif' ... and 5 more } Labels: [demos; demos; imagesci ... and 5 more categorical] ReadFcn: @readDatastoreImage
输入参数
输入数据存储,指定为数据存储对象。输入数据存储可以是 isShuffleable
对其返回 true
的任何数据存储(如 imageDatastore
)。输入数据存储也可以是其所有基础数据存储均可乱序的 CombinedDatastore
、SequentialDatastore
和 TransformedDatastore
。
输出参量
输出数据存储,以数据存储对象形式返回,其中包含来自 ds
的随机排序数据。
扩展功能
用法说明和限制:
在基于线程的环境中,您只能对以下数据存储使用
shuffle
:ImageDatastore
对象使用
combine
或transform
从ImageDatastore
对象创建的CombinedDatastore
、SequentialDatastore
或TransformedDatastore
对象
如果您有 Parallel Computing Toolbox™,则可以对其他数据存储使用
shuffle
。为此,请使用基于进程的并行池运行该函数,而不是使用backgroundPool
或ThreadPool
(使用ProcessPool
或ClusterPool
)。
有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
版本历史记录
在 R2016a 中推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)