本文在调参记录9的基础上,在数据增强部分添加了shear_range = 30,测试Adaptively Parametric ReLU(APReLU)激活函数在Cifar10图像集上的效果。
Keras里ImageDataGenerator的用法见如下网址:
https://fairyonice.github.io/Learn-about-ImageDataGenerator.html
深度残差网络 自适应参数化ReLU激活函数(调参记录9)
https://blog.csdn.net/dangqing1988/article/details/105688144
自适应参数化ReLU激活函数的基本原理见下图:
Keras程序如下:
代码语言:python代码运行次数:0复制#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 14 04:17:45 2020
Implemented using TensorFlow 1.0.1 and Keras 2.2.1
Minghang Zhao, Shisheng Zhong, Xuyun Fu, Baoping Tang, Shaojiang Dong, Michael Pecht,
Deep Residual Networks with Adaptively Parametric Rectifier Linear Units for Fault Diagnosis,
IEEE Transactions on Industrial Electronics, 2020, DOI: 10.1109/TIE.2020.2972458
@author: Minghang Zhao
"""
from __future__ import print_function
import keras
import numpy as np
from keras.datasets import cifar10
from keras.layers import Dense, Conv2D, BatchNormalization, Activation, Minimum
from keras.layers import AveragePooling2D, Input, GlobalAveragePooling2D, Concatenate, Reshape
from keras.regularizers import l2
from keras import backend as K
from keras.models import Model
from keras import optimizers
from keras.preprocessing.image import ImageDataGenerator
from keras.callbacks import LearningRateScheduler
K.set_learning_phase(1)
# The data, split between train and test sets
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
# Noised data
x_train = x_train.astype('float32') / 255.
x_test = x_test.astype('float32') / 255.
x_test = x_test-np.mean(x_train)
x_train = x_train-np.mean(x_train)
print('x_train shape:', x_train.shape)
print(x_train.shape[0], 'train samples')
print(x_test.shape[0], 'test samples')
# convert class vectors to binary class matrices
y_train = keras.utils.to_categorical(y_train, 10)
y_test = keras.utils.to_categorical(y_test, 10)
# Schedule the learning rate, multiply 0.1 every 300 epoches
def scheduler(epoch):
if epoch % 300 == 0 and epoch != 0:
lr = K.get_value(model.optimizer.lr)
K.set_value(model.optimizer.lr, lr * 0.1)
print("lr changed to {}".format(lr * 0.1))
return K.get_value(model.optimizer.lr)
# An adaptively parametric rectifier linear unit (APReLU)
def aprelu(inputs):
# get the number of channels
channels = inputs.get_shape().as_list()[-1]
# get a zero feature map
zeros_input = keras.layers.subtract([inputs, inputs])
# get a feature map with only positive features
pos_input = Activation('relu')(inputs)
# get a feature map with only negative features
neg_input = Minimum()([inputs,zeros_input])
# define a network to obtain the scaling coefficients
scales_p = GlobalAveragePooling2D()(pos_input)
scales_n = GlobalAveragePooling2D()(neg_input)
scales = Concatenate()([scales_n, scales_p])
scales = Dense(channels, activation='linear', kernel_initializer='he_normal', kernel_regularizer=l2(1e-4))(scales)
scales = BatchNormalization(momentum=0.9, gamma_regularizer=l2(1e-4))(scales)
scales = Activation('relu')(scales)
scales = Dense(channels, activation='linear', kernel_initializer='he_normal', kernel_regularizer=l2(1e-4))(scales)
scales = BatchNormalization(momentum=0.9, gamma_regularizer=l2(1e-4))(scales)
scales = Activation('sigmoid')(scales)
scales = Reshape((1,1,channels))(scales)
# apply a paramtetric relu
neg_part = keras.layers.multiply([scales, neg_input])
return keras.layers.add([pos_input, neg_part])
# Residual Block
def residual_block(incoming, nb_blocks, out_channels, downsample=False,
downsample_strides=2):
residual = incoming
in_channels = incoming.get_shape().as_list()[-1]
for i in range(nb_blocks):
identity = residual
if not downsample:
downsample_strides = 1
residual = BatchNormalization(momentum=0.9, gamma_regularizer=l2(1e-4))(residual)
residual = aprelu(residual)
residual = Conv2D(out_channels, 3, strides=(downsample_strides, downsample_strides),
padding='same', kernel_initializer='he_normal',
kernel_regularizer=l2(1e-4))(residual)
residual = BatchNormalization(momentum=0.9, gamma_regularizer=l2(1e-4))(residual)
residual = aprelu(residual)
residual = Conv2D(out_channels, 3, padding='same', kernel_initializer='he_normal',
kernel_regularizer=l2(1e-4))(residual)
# Downsampling
if downsample_strides > 1:
identity = AveragePooling2D(pool_size=(1,1), strides=(2,2))(identity)
# Zero_padding to match channels
if in_channels != out_channels:
zeros_identity = keras.layers.subtract([identity, identity])
identity = keras.layers.concatenate([identity, zeros_identity])
in_channels = out_channels
residual = keras.layers.add([residual, identity])
return residual
# define and train a model
inputs = Input(shape=(32, 32, 3))
net = Conv2D(16, 3, padding='same', kernel_initializer='he_normal', kernel_regularizer=l2(1e-4))(inputs)
net = residual_block(net, 9, 16, downsample=False)
net = residual_block(net, 1, 32, downsample=True)
net = residual_block(net, 8, 32, downsample=False)
net = residual_block(net, 1, 64, downsample=True)
net = residual_block(net, 8, 64, downsample=False)
net = BatchNormalization(momentum=0.9, gamma_regularizer=l2(1e-4))(net)
net = Activation('relu')(net)
net = GlobalAveragePooling2D()(net)
outputs = Dense(10, activation='softmax', kernel_initializer='he_normal', kernel_regularizer=l2(1e-4))(net)
model = Model(inputs=inputs, outputs=outputs)
sgd = optimizers.SGD(lr=0.1, decay=0., momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy'])
# data augmentation
datagen = ImageDataGenerator(
# randomly rotate images in the range (deg 0 to 180)
rotation_range=30,
# shear angle in counter-clockwise direction in degrees
shear_range = 30,
# randomly flip images
horizontal_flip=True,
# randomly shift images horizontally
width_shift_range=0.125,
# randomly shift images vertically
height_shift_range=0.125)
reduce_lr = LearningRateScheduler(scheduler)
# fit the model on the batches generated by datagen.flow().
model.fit_generator(datagen.flow(x_train, y_train, batch_size=100),
validation_data=(x_test, y_test), epochs=1000,
verbose=1, callbacks=[reduce_lr], workers=4)
# get results
K.set_learning_phase(0)
DRSN_train_score = model.evaluate(x_train, y_train, batch_size=100, verbose=0)
print('Train loss:', DRSN_train_score[0])
print('Train accuracy:', DRSN_train_score[1])
DRSN_test_score = model.evaluate(x_test, y_test, batch_size=100, verbose=0)
print('Test loss:', DRSN_test_score[0])
print('Test accuracy:', DRSN_test_score[1])
实验结果如下:
代码语言:python代码运行次数:0复制Epoch 850/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1105 - acc: 0.9978 - val_loss: 0.3705 - val_acc: 0.9305
Epoch 851/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1098 - acc: 0.9978 - val_loss: 0.3752 - val_acc: 0.9290
Epoch 852/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1118 - acc: 0.9971 - val_loss: 0.3773 - val_acc: 0.9280
Epoch 853/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1103 - acc: 0.9978 - val_loss: 0.3732 - val_acc: 0.9303
Epoch 854/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1109 - acc: 0.9977 - val_loss: 0.3715 - val_acc: 0.9302
Epoch 855/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1096 - acc: 0.9977 - val_loss: 0.3780 - val_acc: 0.9306
Epoch 856/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1100 - acc: 0.9977 - val_loss: 0.3764 - val_acc: 0.9290
Epoch 857/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1093 - acc: 0.9981 - val_loss: 0.3750 - val_acc: 0.9291
Epoch 858/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1088 - acc: 0.9980 - val_loss: 0.3738 - val_acc: 0.9287
Epoch 859/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1098 - acc: 0.9975 - val_loss: 0.3711 - val_acc: 0.9291
Epoch 860/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1091 - acc: 0.9979 - val_loss: 0.3636 - val_acc: 0.9302
Epoch 861/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1094 - acc: 0.9976 - val_loss: 0.3689 - val_acc: 0.9303
Epoch 862/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1088 - acc: 0.9978 - val_loss: 0.3687 - val_acc: 0.9306
Epoch 863/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1083 - acc: 0.9978 - val_loss: 0.3720 - val_acc: 0.9318
Epoch 864/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1080 - acc: 0.9978 - val_loss: 0.3695 - val_acc: 0.9302
Epoch 865/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1093 - acc: 0.9973 - val_loss: 0.3733 - val_acc: 0.9297
Epoch 866/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1092 - acc: 0.9974 - val_loss: 0.3713 - val_acc: 0.9296
Epoch 867/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1082 - acc: 0.9978 - val_loss: 0.3674 - val_acc: 0.9306
Epoch 868/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1087 - acc: 0.9974 - val_loss: 0.3684 - val_acc: 0.9296
Epoch 869/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1072 - acc: 0.9982 - val_loss: 0.3684 - val_acc: 0.9307
Epoch 870/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1080 - acc: 0.9976 - val_loss: 0.3695 - val_acc: 0.9294
Epoch 871/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1075 - acc: 0.9977 - val_loss: 0.3655 - val_acc: 0.9306
Epoch 872/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1073 - acc: 0.9979 - val_loss: 0.3667 - val_acc: 0.9303
Epoch 873/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1079 - acc: 0.9977 - val_loss: 0.3717 - val_acc: 0.9278
Epoch 874/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1081 - acc: 0.9973 - val_loss: 0.3722 - val_acc: 0.9292
Epoch 875/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1072 - acc: 0.9975 - val_loss: 0.3716 - val_acc: 0.9298
Epoch 876/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1070 - acc: 0.9977 - val_loss: 0.3721 - val_acc: 0.9311
Epoch 877/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1066 - acc: 0.9978 - val_loss: 0.3722 - val_acc: 0.9289
Epoch 878/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1068 - acc: 0.9977 - val_loss: 0.3736 - val_acc: 0.9296
Epoch 879/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1065 - acc: 0.9977 - val_loss: 0.3767 - val_acc: 0.9280
Epoch 880/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1055 - acc: 0.9979 - val_loss: 0.3741 - val_acc: 0.9285
Epoch 881/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1056 - acc: 0.9979 - val_loss: 0.3716 - val_acc: 0.9290
Epoch 882/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1061 - acc: 0.9977 - val_loss: 0.3736 - val_acc: 0.9295
Epoch 883/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1066 - acc: 0.9976 - val_loss: 0.3745 - val_acc: 0.9307
Epoch 884/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1059 - acc: 0.9975 - val_loss: 0.3702 - val_acc: 0.9302
Epoch 885/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1051 - acc: 0.9979 - val_loss: 0.3656 - val_acc: 0.9311
Epoch 886/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1051 - acc: 0.9978 - val_loss: 0.3677 - val_acc: 0.9305
Epoch 887/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1062 - acc: 0.9974 - val_loss: 0.3636 - val_acc: 0.9315
Epoch 888/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1052 - acc: 0.9977 - val_loss: 0.3710 - val_acc: 0.9295
Epoch 889/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1046 - acc: 0.9979 - val_loss: 0.3642 - val_acc: 0.9318
Epoch 890/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1051 - acc: 0.9975 - val_loss: 0.3673 - val_acc: 0.9306
Epoch 891/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1045 - acc: 0.9978 - val_loss: 0.3681 - val_acc: 0.9299
Epoch 892/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1043 - acc: 0.9979 - val_loss: 0.3659 - val_acc: 0.9320
Epoch 893/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1040 - acc: 0.9979 - val_loss: 0.3627 - val_acc: 0.9326
Epoch 894/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1041 - acc: 0.9976 - val_loss: 0.3698 - val_acc: 0.9301
Epoch 895/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1039 - acc: 0.9978 - val_loss: 0.3659 - val_acc: 0.9321
Epoch 896/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1040 - acc: 0.9978 - val_loss: 0.3718 - val_acc: 0.9300
Epoch 897/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1039 - acc: 0.9977 - val_loss: 0.3728 - val_acc: 0.9311
Epoch 898/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1044 - acc: 0.9973 - val_loss: 0.3743 - val_acc: 0.9313
Epoch 899/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1036 - acc: 0.9976 - val_loss: 0.3675 - val_acc: 0.9312
Epoch 900/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1030 - acc: 0.9979 - val_loss: 0.3730 - val_acc: 0.9313
Epoch 901/1000
lr changed to 9.999999310821295e-05
500/500 [==============================] - 69s 138ms/step - loss: 0.1023 - acc: 0.9982 - val_loss: 0.3709 - val_acc: 0.9310
Epoch 902/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1025 - acc: 0.9979 - val_loss: 0.3690 - val_acc: 0.9311
Epoch 903/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1024 - acc: 0.9980 - val_loss: 0.3679 - val_acc: 0.9311
Epoch 904/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1020 - acc: 0.9982 - val_loss: 0.3673 - val_acc: 0.9315
Epoch 905/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1027 - acc: 0.9979 - val_loss: 0.3672 - val_acc: 0.9310
Epoch 906/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1015 - acc: 0.9984 - val_loss: 0.3678 - val_acc: 0.9304
Epoch 907/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1016 - acc: 0.9984 - val_loss: 0.3673 - val_acc: 0.9302
Epoch 908/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1031 - acc: 0.9977 - val_loss: 0.3667 - val_acc: 0.9307
Epoch 909/1000
500/500 [==============================] - 69s 139ms/step - loss: 0.1019 - acc: 0.9983 - val_loss: 0.3672 - val_acc: 0.9317
Epoch 910/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1018 - acc: 0.9983 - val_loss: 0.3671 - val_acc: 0.9313
Epoch 911/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1018 - acc: 0.9982 - val_loss: 0.3669 - val_acc: 0.9309
Epoch 912/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1014 - acc: 0.9986 - val_loss: 0.3677 - val_acc: 0.9303
Epoch 913/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1015 - acc: 0.9982 - val_loss: 0.3666 - val_acc: 0.9303
Epoch 914/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1015 - acc: 0.9984 - val_loss: 0.3659 - val_acc: 0.9309
Epoch 915/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1013 - acc: 0.9983 - val_loss: 0.3651 - val_acc: 0.9318
Epoch 916/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1014 - acc: 0.9983 - val_loss: 0.3652 - val_acc: 0.9322
Epoch 917/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1010 - acc: 0.9984 - val_loss: 0.3648 - val_acc: 0.9322
Epoch 918/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1016 - acc: 0.9981 - val_loss: 0.3644 - val_acc: 0.9324
Epoch 919/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1013 - acc: 0.9983 - val_loss: 0.3635 - val_acc: 0.9319
Epoch 920/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1008 - acc: 0.9984 - val_loss: 0.3629 - val_acc: 0.9318
Epoch 921/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1006 - acc: 0.9986 - val_loss: 0.3627 - val_acc: 0.9319
Epoch 922/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1007 - acc: 0.9985 - val_loss: 0.3632 - val_acc: 0.9314
Epoch 923/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1004 - acc: 0.9987 - val_loss: 0.3626 - val_acc: 0.9319
Epoch 924/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1012 - acc: 0.9985 - val_loss: 0.3629 - val_acc: 0.9319
Epoch 925/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1011 - acc: 0.9983 - val_loss: 0.3620 - val_acc: 0.9318
Epoch 926/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1005 - acc: 0.9987 - val_loss: 0.3617 - val_acc: 0.9322
Epoch 927/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1013 - acc: 0.9983 - val_loss: 0.3618 - val_acc: 0.9330
Epoch 928/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1005 - acc: 0.9985 - val_loss: 0.3614 - val_acc: 0.9321
Epoch 929/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1006 - acc: 0.9985 - val_loss: 0.3616 - val_acc: 0.9319
Epoch 930/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1006 - acc: 0.9985 - val_loss: 0.3613 - val_acc: 0.9321
Epoch 931/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1009 - acc: 0.9985 - val_loss: 0.3612 - val_acc: 0.9328
Epoch 932/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1004 - acc: 0.9985 - val_loss: 0.3612 - val_acc: 0.9319
Epoch 933/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1004 - acc: 0.9987 - val_loss: 0.3618 - val_acc: 0.9314
Epoch 934/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1008 - acc: 0.9983 - val_loss: 0.3615 - val_acc: 0.9316
Epoch 935/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1011 - acc: 0.9983 - val_loss: 0.3621 - val_acc: 0.9317
Epoch 936/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1008 - acc: 0.9985 - val_loss: 0.3617 - val_acc: 0.9320
Epoch 937/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1006 - acc: 0.9984 - val_loss: 0.3613 - val_acc: 0.9322
Epoch 938/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1008 - acc: 0.9985 - val_loss: 0.3613 - val_acc: 0.9325
Epoch 939/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1006 - acc: 0.9984 - val_loss: 0.3614 - val_acc: 0.9326
Epoch 940/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1006 - acc: 0.9983 - val_loss: 0.3612 - val_acc: 0.9320
Epoch 941/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1005 - acc: 0.9984 - val_loss: 0.3612 - val_acc: 0.9322
Epoch 942/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1001 - acc: 0.9986 - val_loss: 0.3615 - val_acc: 0.9318
Epoch 943/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0998 - acc: 0.9987 - val_loss: 0.3613 - val_acc: 0.9320
Epoch 944/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1006 - acc: 0.9985 - val_loss: 0.3613 - val_acc: 0.9323
Epoch 945/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1000 - acc: 0.9985 - val_loss: 0.3608 - val_acc: 0.9319
Epoch 946/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1001 - acc: 0.9987 - val_loss: 0.3608 - val_acc: 0.9313
Epoch 947/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0998 - acc: 0.9987 - val_loss: 0.3606 - val_acc: 0.9314
Epoch 948/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1000 - acc: 0.9986 - val_loss: 0.3609 - val_acc: 0.9311
Epoch 949/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0995 - acc: 0.9988 - val_loss: 0.3610 - val_acc: 0.9316
Epoch 950/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0999 - acc: 0.9986 - val_loss: 0.3609 - val_acc: 0.9317
Epoch 951/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1002 - acc: 0.9986 - val_loss: 0.3612 - val_acc: 0.9314
Epoch 952/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0992 - acc: 0.9989 - val_loss: 0.3618 - val_acc: 0.9312
Epoch 953/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0996 - acc: 0.9988 - val_loss: 0.3617 - val_acc: 0.9317
Epoch 954/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0994 - acc: 0.9987 - val_loss: 0.3617 - val_acc: 0.9323
Epoch 955/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1004 - acc: 0.9984 - val_loss: 0.3610 - val_acc: 0.9320
Epoch 956/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.1000 - acc: 0.9986 - val_loss: 0.3616 - val_acc: 0.9318
Epoch 957/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1000 - acc: 0.9985 - val_loss: 0.3617 - val_acc: 0.9319
Epoch 958/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0996 - acc: 0.9985 - val_loss: 0.3627 - val_acc: 0.9323
Epoch 959/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0995 - acc: 0.9987 - val_loss: 0.3625 - val_acc: 0.9316
Epoch 960/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0995 - acc: 0.9987 - val_loss: 0.3634 - val_acc: 0.9317
Epoch 961/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0998 - acc: 0.9985 - val_loss: 0.3636 - val_acc: 0.9318
Epoch 962/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0997 - acc: 0.9986 - val_loss: 0.3645 - val_acc: 0.9319
Epoch 963/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1001 - acc: 0.9984 - val_loss: 0.3637 - val_acc: 0.9316
Epoch 964/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0998 - acc: 0.9985 - val_loss: 0.3631 - val_acc: 0.9317
Epoch 965/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0995 - acc: 0.9988 - val_loss: 0.3625 - val_acc: 0.9316
Epoch 966/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0998 - acc: 0.9986 - val_loss: 0.3622 - val_acc: 0.9324
Epoch 967/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.1002 - acc: 0.9985 - val_loss: 0.3623 - val_acc: 0.9327
Epoch 968/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0993 - acc: 0.9987 - val_loss: 0.3627 - val_acc: 0.9324
Epoch 969/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0996 - acc: 0.9985 - val_loss: 0.3624 - val_acc: 0.9327
Epoch 970/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0999 - acc: 0.9985 - val_loss: 0.3618 - val_acc: 0.9323
Epoch 971/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.1001 - acc: 0.9983 - val_loss: 0.3616 - val_acc: 0.9324
Epoch 972/1000
500/500 [==============================] - 68s 136ms/step - loss: 0.0994 - acc: 0.9986 - val_loss: 0.3620 - val_acc: 0.9320
Epoch 973/1000
500/500 [==============================] - 68s 136ms/step - loss: 0.0997 - acc: 0.9985 - val_loss: 0.3627 - val_acc: 0.9324
Epoch 974/1000
500/500 [==============================] - 68s 136ms/step - loss: 0.1000 - acc: 0.9985 - val_loss: 0.3623 - val_acc: 0.9321
Epoch 975/1000
500/500 [==============================] - 68s 135ms/step - loss: 0.0989 - acc: 0.9990 - val_loss: 0.3619 - val_acc: 0.9321
Epoch 976/1000
500/500 [==============================] - 68s 136ms/step - loss: 0.0992 - acc: 0.9987 - val_loss: 0.3612 - val_acc: 0.9323
Epoch 977/1000
500/500 [==============================] - 68s 136ms/step - loss: 0.0996 - acc: 0.9986 - val_loss: 0.3612 - val_acc: 0.9317
Epoch 978/1000
500/500 [==============================] - 68s 136ms/step - loss: 0.0997 - acc: 0.9986 - val_loss: 0.3610 - val_acc: 0.9326
Epoch 979/1000
500/500 [==============================] - 68s 136ms/step - loss: 0.0991 - acc: 0.9987 - val_loss: 0.3611 - val_acc: 0.9327
Epoch 980/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0988 - acc: 0.9989 - val_loss: 0.3615 - val_acc: 0.9326
Epoch 981/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0992 - acc: 0.9987 - val_loss: 0.3619 - val_acc: 0.9324
Epoch 982/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0994 - acc: 0.9986 - val_loss: 0.3619 - val_acc: 0.9332
Epoch 983/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0995 - acc: 0.9986 - val_loss: 0.3617 - val_acc: 0.9329
Epoch 984/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0991 - acc: 0.9987 - val_loss: 0.3622 - val_acc: 0.9328
Epoch 985/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0991 - acc: 0.9987 - val_loss: 0.3628 - val_acc: 0.9322
Epoch 986/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0993 - acc: 0.9987 - val_loss: 0.3625 - val_acc: 0.9319
Epoch 987/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0995 - acc: 0.9986 - val_loss: 0.3629 - val_acc: 0.9317
Epoch 988/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0993 - acc: 0.9985 - val_loss: 0.3628 - val_acc: 0.9319
Epoch 989/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0997 - acc: 0.9984 - val_loss: 0.3624 - val_acc: 0.9322
Epoch 990/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0993 - acc: 0.9986 - val_loss: 0.3622 - val_acc: 0.9323
Epoch 991/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0993 - acc: 0.9986 - val_loss: 0.3625 - val_acc: 0.9327
Epoch 992/1000
500/500 [==============================] - 69s 137ms/step - loss: 0.0993 - acc: 0.9988 - val_loss: 0.3630 - val_acc: 0.9325
Epoch 993/1000
500/500 [==============================] - 68s 137ms/step - loss: 0.0992 - acc: 0.9984 - val_loss: 0.3634 - val_acc: 0.9320
Epoch 994/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0991 - acc: 0.9988 - val_loss: 0.3627 - val_acc: 0.9328
Epoch 995/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0989 - acc: 0.9989 - val_loss: 0.3637 - val_acc: 0.9321
Epoch 996/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0994 - acc: 0.9986 - val_loss: 0.3623 - val_acc: 0.9319
Epoch 997/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0987 - acc: 0.9987 - val_loss: 0.3622 - val_acc: 0.9322
Epoch 998/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0989 - acc: 0.9988 - val_loss: 0.3621 - val_acc: 0.9325
Epoch 999/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0993 - acc: 0.9984 - val_loss: 0.3615 - val_acc: 0.9326
Epoch 1000/1000
500/500 [==============================] - 69s 138ms/step - loss: 0.0986 - acc: 0.9988 - val_loss: 0.3614 - val_acc: 0.9323
Train loss: 0.09943642792105675
Train accuracy: 0.9982600016593933
Test loss: 0.3614072059094906
Test accuracy: 0.9322999995946885
在使用了shear_range = 30的数据增强以后,准确率降了呢。
Minghang Zhao, Shisheng Zhong, Xuyun Fu, Baoping Tang, Shaojiang Dong, Michael Pecht, Deep Residual Networks with Adaptively Parametric Rectifier Linear Units for Fault Diagnosis, IEEE Transactions on Industrial Electronics, 2020, DOI: 10.1109/TIE.2020.2972458
https://ieeexplore.ieee.org/document/8998530
————————————————
版权声明:本文为CSDN博主「dangqing1988」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/dangqing1988/article/details/105712292