我已经训练了80%的数据图像,但只想旋转和裁剪10%。如何旋转和作物只有10%和显示裁剪图像
1次观看(过去30天)
显示旧的注释
清晰;
clc;
imds = imageDatastore('D:\dataimage',' inclesubfolders ',true,'LabelSource','foldernames');
[imdsTrain,imdsValidation,imdsTest] = splitEachLabel(imds,0.8,0.1,0.1);
augimdsTrain = augmentedImageDatastore([227 227],imdsTrain);
augimdsValidation = augmentedImageDatastore([227 227],imdsValidation);% resize图像
augimdsTest = augmentedImageDatastore([227 227],imdsTest);
g =装天花板((t1.Count * 10/100));
0评论
答案(1)
Prateek拉伊
2021年9月13日
根据我的理解,您已经训练了数据图像的80%,但只想旋转和裁剪10%。
对于裁剪,您可以使用" OutputSizeMode' augmentedImageDatastore'的名称-值对,并根据您的需要将其设置为'centercrop'或'randcrop'。
augimdsValidation = augmentedImageDatastore([227 227],imdsValidation,“OutputSizeMode”,“centercrop”);
对于旋转,你可以使用'augmentedImageDatastore'中的'imageDataAugmenter'。'imageDataAugmenter'将使用'RandRotation'来设置旋转范围。
imageDataAugmenter使用'RandRotation'来设置旋转范围。
augmenter = imageDataAugmenter(“RandRotation”360年[0]);
'imageDataAugmenter'将作为'DataAugmentation'名值对传递给'augmentedImageDatastore'
augimdsValidation = augmentedImageDatastore([227 227],imdsValidation,“DataAugmentation”、增压器);
你可以用俱乐部来获得作物和轮作:
augmenter = imageDataAugmenter(“RandRotation”360年[0]);
augimdsValidation = augmentedImageDatastore([227 227],imdsValidation,“OutputSizeMode”,“centercrop”,“DataAugmentation”、增压器);
你可以参考
augmentedImageDatastore
查找有关augmentedImageDatastore和
imageDataAugmenter
请参阅MathWorks文档页,以查找有关imageDataAugmenter的更多信息。