轴承故障检测(分类任务)+傅里叶变化+CNN+matlab-4 cnn模型

时间:2024-05-04 10:12:38

搭建一个普通的模型就行,因为这个数据集识别准确率特别高,最后都能到100%

% 设置图像文件夹路径
data_folder = 'images';

% 创建图像数据存储器
imds = imageDatastore(data_folder, ...
    'IncludeSubfolders', true, 'LabelSource', 'foldernames');
[train_imds, test_imds] = splitEachLabel(imds, 0.7, 'randomized');


% 构建 CNN 模型
layers = [
    imageInputLayer([224 224 3])
    convolution2dLayer(3, 16, 'Padding', 'same')
    batchNormalizationLayer
    reluLayer
    maxPooling2dLayer(2, 'Stride', 2)
    convolution2dLayer(3, 32, 'Padding', 'same')
    batchNormalizationLayer
    reluLayer
    maxPooling2dLayer(2, 'Stride', 2)
    convolution2dLayer(3, 64, 'Padding', 'same')
    batchNormalizationLayer
    reluLayer
    fullyConnectedLayer(10)
    softmaxLayer
    classificationLayer
];
详情加Q 596520206 同样提供python版本