前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >一种Dynamic ReLU:自适应参数化ReLU激活函数(调参记录1)

一种Dynamic ReLU:自适应参数化ReLU激活函数(调参记录1)

作者头像
用户7368967
修改2020-05-25 10:29:29
4920
修改2020-05-25 10:29:29
举报
文章被收录于专栏:深度学习知识

自适应参数化ReLU是一种动态ReLU(Dynamic ReLU)激活函数,在2019年5月3日投稿至IEEE Transactions on Industrial Electronics,在2020年1月24日(农历大年初一)录用,于2020年2月13日在IEEE官网发布预览版。

在本文中,采用了深度残差网络和自适应参数化ReLU,构造了一个小型神经网络(包含9个残差模块,卷积核的个数比较少,最少是8个,最多是32个),在Cifar10图像数据集上进行了实验。

其中,自适应参数化ReLU激活函数原本是应用在基于振动信号的故障诊断,是ReLU的一种动态化改进,其基本原理如下图所示:

自适应参数化ReLU:一种Dynamic ReLU激活函数
自适应参数化ReLU:一种Dynamic 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, Date of Publication: 13 February 2020

@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()
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 400 epoches
def scheduler(epoch):
    if epoch % 400 == 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//4, activation='linear', kernel_initializer='he_normal', kernel_regularizer=l2(1e-4))(scales)
    scales = BatchNormalization()(scales)
    scales = Activation('relu')(scales)
    scales = Dense(channels, activation='linear', kernel_initializer='he_normal', kernel_regularizer=l2(1e-4))(scales)
    scales = BatchNormalization()(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()(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()(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(8, 3, padding='same', kernel_initializer='he_normal', kernel_regularizer=l2(1e-4))(inputs)
net = residual_block(net, 3, 8, downsample=False)
net = residual_block(net, 1, 16, downsample=True)
net = residual_block(net, 2, 16, downsample=False)
net = residual_block(net, 1, 32, downsample=True)
net = residual_block(net, 2, 32, downsample=False)
net = BatchNormalization()(net)
net = aprelu(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,
    # 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_score1 = model.evaluate(x_train, y_train, batch_size=100, verbose=0)
print('Train loss:', DRSN_train_score1[0])
print('Train accuracy:', DRSN_train_score1[1])
DRSN_test_score1 = model.evaluate(x_test, y_test, batch_size=100, verbose=0)
print('Test loss:', DRSN_test_score1[0])
print('Test accuracy:', DRSN_test_score1[1])

部分实验结果如下:

代码语言:python
代码运行次数:0
复制
Epoch 755/1000
19s 39ms/step - loss: 0.3548 - acc: 0.9084 - val_loss: 0.4584 - val_acc: 0.8794
Epoch 756/1000
19s 38ms/step - loss: 0.3526 - acc: 0.9098 - val_loss: 0.4647 - val_acc: 0.8727
Epoch 757/1000
19s 38ms/step - loss: 0.3516 - acc: 0.9083 - val_loss: 0.4516 - val_acc: 0.8815
Epoch 758/1000
19s 38ms/step - loss: 0.3508 - acc: 0.9098 - val_loss: 0.4639 - val_acc: 0.8785
Epoch 759/1000
19s 38ms/step - loss: 0.3565 - acc: 0.9078 - val_loss: 0.4542 - val_acc: 0.8751
Epoch 760/1000
19s 38ms/step - loss: 0.3556 - acc: 0.9077 - val_loss: 0.4681 - val_acc: 0.8729
Epoch 761/1000
19s 38ms/step - loss: 0.3519 - acc: 0.9089 - val_loss: 0.4459 - val_acc: 0.8824
Epoch 762/1000
19s 39ms/step - loss: 0.3523 - acc: 0.9085 - val_loss: 0.4528 - val_acc: 0.8766
Epoch 763/1000
19s 38ms/step - loss: 0.3565 - acc: 0.9071 - val_loss: 0.4621 - val_acc: 0.8773
Epoch 764/1000
19s 38ms/step - loss: 0.3532 - acc: 0.9084 - val_loss: 0.4570 - val_acc: 0.8751
Epoch 765/1000
19s 38ms/step - loss: 0.3561 - acc: 0.9068 - val_loss: 0.4551 - val_acc: 0.8780
Epoch 766/1000
19s 38ms/step - loss: 0.3515 - acc: 0.9093 - val_loss: 0.4583 - val_acc: 0.8796
Epoch 767/1000
19s 38ms/step - loss: 0.3532 - acc: 0.9083 - val_loss: 0.4591 - val_acc: 0.8805
Epoch 768/1000
19s 38ms/step - loss: 0.3531 - acc: 0.9088 - val_loss: 0.4725 - val_acc: 0.8733
Epoch 769/1000
19s 38ms/step - loss: 0.3556 - acc: 0.9082 - val_loss: 0.4599 - val_acc: 0.8796
Epoch 770/1000
19s 38ms/step - loss: 0.3540 - acc: 0.9087 - val_loss: 0.4635 - val_acc: 0.8792
Epoch 771/1000
19s 39ms/step - loss: 0.3549 - acc: 0.9068 - val_loss: 0.4534 - val_acc: 0.8769
Epoch 772/1000
19s 38ms/step - loss: 0.3560 - acc: 0.9080 - val_loss: 0.4550 - val_acc: 0.8790
Epoch 773/1000
19s 38ms/step - loss: 0.3569 - acc: 0.9066 - val_loss: 0.4524 - val_acc: 0.8788
Epoch 774/1000
19s 38ms/step - loss: 0.3542 - acc: 0.9071 - val_loss: 0.4542 - val_acc: 0.8802
Epoch 775/1000
19s 38ms/step - loss: 0.3532 - acc: 0.9085 - val_loss: 0.4764 - val_acc: 0.8734
Epoch 776/1000
19s 38ms/step - loss: 0.3549 - acc: 0.9072 - val_loss: 0.4720 - val_acc: 0.8732
Epoch 777/1000
19s 39ms/step - loss: 0.3537 - acc: 0.9078 - val_loss: 0.4567 - val_acc: 0.8778
Epoch 778/1000
19s 38ms/step - loss: 0.3537 - acc: 0.9073 - val_loss: 0.4579 - val_acc: 0.8759
Epoch 779/1000
19s 38ms/step - loss: 0.3538 - acc: 0.9090 - val_loss: 0.4735 - val_acc: 0.8716
Epoch 780/1000
19s 38ms/step - loss: 0.3584 - acc: 0.9066 - val_loss: 0.4611 - val_acc: 0.8756
Epoch 781/1000
19s 38ms/step - loss: 0.3558 - acc: 0.9077 - val_loss: 0.4480 - val_acc: 0.8815
Epoch 782/1000
19s 38ms/step - loss: 0.3546 - acc: 0.9073 - val_loss: 0.4704 - val_acc: 0.8767
Epoch 783/1000
19s 38ms/step - loss: 0.3547 - acc: 0.9082 - val_loss: 0.4604 - val_acc: 0.8808
Epoch 784/1000
19s 38ms/step - loss: 0.3502 - acc: 0.9099 - val_loss: 0.4570 - val_acc: 0.8805
Epoch 785/1000
19s 39ms/step - loss: 0.3517 - acc: 0.9109 - val_loss: 0.4589 - val_acc: 0.8781
Epoch 786/1000
19s 38ms/step - loss: 0.3530 - acc: 0.9077 - val_loss: 0.4554 - val_acc: 0.8791
Epoch 787/1000
19s 38ms/step - loss: 0.3563 - acc: 0.9073 - val_loss: 0.4650 - val_acc: 0.8742
Epoch 788/1000
19s 38ms/step - loss: 0.3544 - acc: 0.9093 - val_loss: 0.4657 - val_acc: 0.8739
Epoch 789/1000
19s 38ms/step - loss: 0.3521 - acc: 0.9096 - val_loss: 0.4550 - val_acc: 0.8786
Epoch 790/1000
19s 38ms/step - loss: 0.3507 - acc: 0.9092 - val_loss: 0.4748 - val_acc: 0.8742
Epoch 791/1000
19s 38ms/step - loss: 0.3505 - acc: 0.9094 - val_loss: 0.4734 - val_acc: 0.8731
Epoch 792/1000
19s 39ms/step - loss: 0.3565 - acc: 0.9088 - val_loss: 0.4669 - val_acc: 0.8729
Epoch 793/1000
19s 39ms/step - loss: 0.3502 - acc: 0.9100 - val_loss: 0.4652 - val_acc: 0.8771
Epoch 794/1000
19s 38ms/step - loss: 0.3514 - acc: 0.9088 - val_loss: 0.4752 - val_acc: 0.8723
Epoch 795/1000
19s 38ms/step - loss: 0.3538 - acc: 0.9084 - val_loss: 0.4646 - val_acc: 0.8786
Epoch 796/1000
19s 38ms/step - loss: 0.3541 - acc: 0.9080 - val_loss: 0.4740 - val_acc: 0.8780
Epoch 797/1000
19s 38ms/step - loss: 0.3544 - acc: 0.9076 - val_loss: 0.4562 - val_acc: 0.8796
Epoch 798/1000
19s 38ms/step - loss: 0.3551 - acc: 0.9080 - val_loss: 0.4681 - val_acc: 0.8738
Epoch 799/1000
19s 38ms/step - loss: 0.3515 - acc: 0.9091 - val_loss: 0.4545 - val_acc: 0.8801
Epoch 800/1000
19s 38ms/step - loss: 0.3545 - acc: 0.9088 - val_loss: 0.4552 - val_acc: 0.8809
Epoch 801/1000
lr changed to 0.0009999999776482583
19s 38ms/step - loss: 0.3211 - acc: 0.9201 - val_loss: 0.4238 - val_acc: 0.8918
Epoch 802/1000
19s 38ms/step - loss: 0.3056 - acc: 0.9259 - val_loss: 0.4218 - val_acc: 0.8925
Epoch 803/1000
19s 39ms/step - loss: 0.2945 - acc: 0.9303 - val_loss: 0.4213 - val_acc: 0.8942
Epoch 804/1000
19s 38ms/step - loss: 0.2926 - acc: 0.9300 - val_loss: 0.4196 - val_acc: 0.8944
Epoch 805/1000
19s 38ms/step - loss: 0.2877 - acc: 0.9332 - val_loss: 0.4221 - val_acc: 0.8914
Epoch 806/1000
19s 38ms/step - loss: 0.2899 - acc: 0.9309 - val_loss: 0.4191 - val_acc: 0.8930
Epoch 807/1000
19s 38ms/step - loss: 0.2853 - acc: 0.9334 - val_loss: 0.4184 - val_acc: 0.8939
Epoch 808/1000
19s 38ms/step - loss: 0.2868 - acc: 0.9313 - val_loss: 0.4171 - val_acc: 0.8934
Epoch 809/1000
19s 38ms/step - loss: 0.2806 - acc: 0.9335 - val_loss: 0.4172 - val_acc: 0.8920
Epoch 810/1000
19s 38ms/step - loss: 0.2769 - acc: 0.9356 - val_loss: 0.4212 - val_acc: 0.8934
Epoch 811/1000
19s 38ms/step - loss: 0.2816 - acc: 0.9338 - val_loss: 0.4186 - val_acc: 0.8899
Epoch 812/1000
19s 38ms/step - loss: 0.2791 - acc: 0.9347 - val_loss: 0.4183 - val_acc: 0.8924
Epoch 813/1000
19s 39ms/step - loss: 0.2788 - acc: 0.9345 - val_loss: 0.4217 - val_acc: 0.8918
Epoch 814/1000
19s 39ms/step - loss: 0.2765 - acc: 0.9362 - val_loss: 0.4181 - val_acc: 0.8947
Epoch 815/1000
19s 39ms/step - loss: 0.2778 - acc: 0.9345 - val_loss: 0.4234 - val_acc: 0.8934
Epoch 816/1000
19s 38ms/step - loss: 0.2760 - acc: 0.9347 - val_loss: 0.4227 - val_acc: 0.8913
Epoch 817/1000
19s 39ms/step - loss: 0.2740 - acc: 0.9358 - val_loss: 0.4221 - val_acc: 0.8954
Epoch 818/1000
19s 39ms/step - loss: 0.2733 - acc: 0.9369 - val_loss: 0.4209 - val_acc: 0.8929
Epoch 819/1000
19s 39ms/step - loss: 0.2741 - acc: 0.9354 - val_loss: 0.4224 - val_acc: 0.8921
Epoch 820/1000
19s 39ms/step - loss: 0.2732 - acc: 0.9354 - val_loss: 0.4211 - val_acc: 0.8927
Epoch 821/1000
19s 38ms/step - loss: 0.2730 - acc: 0.9356 - val_loss: 0.4227 - val_acc: 0.8937
Epoch 822/1000
19s 39ms/step - loss: 0.2737 - acc: 0.9361 - val_loss: 0.4218 - val_acc: 0.8938
Epoch 823/1000
19s 39ms/step - loss: 0.2691 - acc: 0.9367 - val_loss: 0.4243 - val_acc: 0.8930
Epoch 824/1000
19s 39ms/step - loss: 0.2712 - acc: 0.9372 - val_loss: 0.4230 - val_acc: 0.8934
Epoch 825/1000
19s 39ms/step - loss: 0.2676 - acc: 0.9385 - val_loss: 0.4271 - val_acc: 0.8913
Epoch 826/1000
19s 39ms/step - loss: 0.2703 - acc: 0.9356 - val_loss: 0.4237 - val_acc: 0.8921
Epoch 827/1000
19s 39ms/step - loss: 0.2673 - acc: 0.9379 - val_loss: 0.4238 - val_acc: 0.8922
Epoch 828/1000
19s 39ms/step - loss: 0.2682 - acc: 0.9370 - val_loss: 0.4199 - val_acc: 0.8946
Epoch 829/1000
19s 39ms/step - loss: 0.2678 - acc: 0.9368 - val_loss: 0.4235 - val_acc: 0.8921
Epoch 830/1000
19s 39ms/step - loss: 0.2639 - acc: 0.9380 - val_loss: 0.4213 - val_acc: 0.8934
Epoch 831/1000
19s 38ms/step - loss: 0.2653 - acc: 0.9377 - val_loss: 0.4210 - val_acc: 0.8946
Epoch 832/1000
19s 39ms/step - loss: 0.2662 - acc: 0.9373 - val_loss: 0.4214 - val_acc: 0.8946
Epoch 833/1000
19s 39ms/step - loss: 0.2663 - acc: 0.9383 - val_loss: 0.4239 - val_acc: 0.8908
Epoch 834/1000
19s 39ms/step - loss: 0.2629 - acc: 0.9385 - val_loss: 0.4236 - val_acc: 0.8909
Epoch 835/1000
19s 39ms/step - loss: 0.2654 - acc: 0.9375 - val_loss: 0.4201 - val_acc: 0.8931
Epoch 836/1000
19s 39ms/step - loss: 0.2651 - acc: 0.9382 - val_loss: 0.4227 - val_acc: 0.8921
Epoch 837/1000
19s 38ms/step - loss: 0.2660 - acc: 0.9376 - val_loss: 0.4253 - val_acc: 0.8911
Epoch 838/1000
19s 38ms/step - loss: 0.2627 - acc: 0.9371 - val_loss: 0.4218 - val_acc: 0.8926
Epoch 839/1000
19s 38ms/step - loss: 0.2644 - acc: 0.9380 - val_loss: 0.4216 - val_acc: 0.8921
Epoch 840/1000
19s 39ms/step - loss: 0.2617 - acc: 0.9389 - val_loss: 0.4208 - val_acc: 0.8927
Epoch 841/1000
19s 39ms/step - loss: 0.2622 - acc: 0.9392 - val_loss: 0.4220 - val_acc: 0.8930
Epoch 842/1000
19s 39ms/step - loss: 0.2632 - acc: 0.9381 - val_loss: 0.4228 - val_acc: 0.8927
Epoch 843/1000
19s 39ms/step - loss: 0.2607 - acc: 0.9390 - val_loss: 0.4271 - val_acc: 0.8915
Epoch 844/1000
19s 39ms/step - loss: 0.2608 - acc: 0.9397 - val_loss: 0.4238 - val_acc: 0.8909
Epoch 845/1000
19s 39ms/step - loss: 0.2606 - acc: 0.9392 - val_loss: 0.4214 - val_acc: 0.8920
Epoch 846/1000
19s 38ms/step - loss: 0.2612 - acc: 0.9391 - val_loss: 0.4245 - val_acc: 0.8928
Epoch 847/1000
19s 38ms/step - loss: 0.2559 - acc: 0.9409 - val_loss: 0.4236 - val_acc: 0.8924
Epoch 848/1000
19s 39ms/step - loss: 0.2571 - acc: 0.9405 - val_loss: 0.4235 - val_acc: 0.8920
Epoch 849/1000
19s 39ms/step - loss: 0.2621 - acc: 0.9381 - val_loss: 0.4209 - val_acc: 0.8946
Epoch 850/1000
19s 38ms/step - loss: 0.2567 - acc: 0.9389 - val_loss: 0.4245 - val_acc: 0.8943
Epoch 851/1000
19s 38ms/step - loss: 0.2567 - acc: 0.9392 - val_loss: 0.4223 - val_acc: 0.8917
Epoch 852/1000
19s 38ms/step - loss: 0.2596 - acc: 0.9383 - val_loss: 0.4222 - val_acc: 0.8915
Epoch 853/1000
19s 38ms/step - loss: 0.2542 - acc: 0.9406 - val_loss: 0.4214 - val_acc: 0.8935
Epoch 854/1000
19s 38ms/step - loss: 0.2572 - acc: 0.9403 - val_loss: 0.4232 - val_acc: 0.8905
Epoch 855/1000
19s 38ms/step - loss: 0.2573 - acc: 0.9394 - val_loss: 0.4231 - val_acc: 0.8906
Epoch 856/1000
19s 39ms/step - loss: 0.2558 - acc: 0.9394 - val_loss: 0.4230 - val_acc: 0.8926
Epoch 857/1000
19s 38ms/step - loss: 0.2557 - acc: 0.9400 - val_loss: 0.4244 - val_acc: 0.8921
Epoch 858/1000
19s 39ms/step - loss: 0.2590 - acc: 0.9380 - val_loss: 0.4252 - val_acc: 0.8914
Epoch 859/1000
19s 39ms/step - loss: 0.2598 - acc: 0.9382 - val_loss: 0.4204 - val_acc: 0.8921
Epoch 860/1000
19s 39ms/step - loss: 0.2544 - acc: 0.9415 - val_loss: 0.4240 - val_acc: 0.8900
Epoch 861/1000
19s 39ms/step - loss: 0.2533 - acc: 0.9413 - val_loss: 0.4221 - val_acc: 0.8930
Epoch 862/1000
19s 38ms/step - loss: 0.2524 - acc: 0.9408 - val_loss: 0.4222 - val_acc: 0.8909
Epoch 863/1000
19s 38ms/step - loss: 0.2516 - acc: 0.9407 - val_loss: 0.4189 - val_acc: 0.8934
Epoch 864/1000
19s 38ms/step - loss: 0.2577 - acc: 0.9394 - val_loss: 0.4234 - val_acc: 0.8925
Epoch 865/1000
19s 38ms/step - loss: 0.2585 - acc: 0.9391 - val_loss: 0.4206 - val_acc: 0.8916
Epoch 866/1000
19s 39ms/step - loss: 0.2546 - acc: 0.9403 - val_loss: 0.4188 - val_acc: 0.8926
Epoch 867/1000
19s 39ms/step - loss: 0.2524 - acc: 0.9409 - val_loss: 0.4200 - val_acc: 0.8927
Epoch 868/1000
19s 39ms/step - loss: 0.2511 - acc: 0.9409 - val_loss: 0.4215 - val_acc: 0.8918
Epoch 869/1000
19s 38ms/step - loss: 0.2529 - acc: 0.9404 - val_loss: 0.4174 - val_acc: 0.8924
Epoch 870/1000
19s 39ms/step - loss: 0.2571 - acc: 0.9390 - val_loss: 0.4217 - val_acc: 0.8927
Epoch 871/1000
19s 38ms/step - loss: 0.2521 - acc: 0.9401 - val_loss: 0.4194 - val_acc: 0.8922
Epoch 872/1000
19s 39ms/step - loss: 0.2525 - acc: 0.9403 - val_loss: 0.4219 - val_acc: 0.8916
Epoch 873/1000
19s 38ms/step - loss: 0.2548 - acc: 0.9397 - val_loss: 0.4215 - val_acc: 0.8909
Epoch 874/1000
19s 39ms/step - loss: 0.2507 - acc: 0.9415 - val_loss: 0.4220 - val_acc: 0.8919
Epoch 875/1000
19s 39ms/step - loss: 0.2505 - acc: 0.9406 - val_loss: 0.4207 - val_acc: 0.8925
Epoch 876/1000
19s 39ms/step - loss: 0.2492 - acc: 0.9419 - val_loss: 0.4204 - val_acc: 0.8921
Epoch 877/1000
19s 38ms/step - loss: 0.2540 - acc: 0.9399 - val_loss: 0.4251 - val_acc: 0.8885
Epoch 878/1000
19s 38ms/step - loss: 0.2503 - acc: 0.9411 - val_loss: 0.4234 - val_acc: 0.8917
Epoch 879/1000
19s 38ms/step - loss: 0.2516 - acc: 0.9398 - val_loss: 0.4210 - val_acc: 0.8905
Epoch 880/1000
19s 38ms/step - loss: 0.2526 - acc: 0.9401 - val_loss: 0.4258 - val_acc: 0.8894
Epoch 881/1000
19s 38ms/step - loss: 0.2527 - acc: 0.9397 - val_loss: 0.4214 - val_acc: 0.8919
Epoch 882/1000
19s 39ms/step - loss: 0.2532 - acc: 0.9399 - val_loss: 0.4269 - val_acc: 0.8884
Epoch 883/1000
19s 39ms/step - loss: 0.2512 - acc: 0.9405 - val_loss: 0.4226 - val_acc: 0.8914
Epoch 884/1000
19s 38ms/step - loss: 0.2471 - acc: 0.9415 - val_loss: 0.4224 - val_acc: 0.8920
Epoch 885/1000
19s 39ms/step - loss: 0.2474 - acc: 0.9414 - val_loss: 0.4277 - val_acc: 0.8906
Epoch 886/1000
19s 39ms/step - loss: 0.2466 - acc: 0.9419 - val_loss: 0.4293 - val_acc: 0.8885
Epoch 887/1000
19s 39ms/step - loss: 0.2488 - acc: 0.9408 - val_loss: 0.4277 - val_acc: 0.8907
Epoch 888/1000
19s 39ms/step - loss: 0.2478 - acc: 0.9415 - val_loss: 0.4227 - val_acc: 0.8905
Epoch 889/1000
19s 38ms/step - loss: 0.2467 - acc: 0.9401 - val_loss: 0.4265 - val_acc: 0.8892
Epoch 890/1000
19s 38ms/step - loss: 0.2491 - acc: 0.9400 - val_loss: 0.4250 - val_acc: 0.8904
Epoch 891/1000
19s 39ms/step - loss: 0.2485 - acc: 0.9409 - val_loss: 0.4211 - val_acc: 0.8909
Epoch 892/1000
19s 38ms/step - loss: 0.2454 - acc: 0.9410 - val_loss: 0.4259 - val_acc: 0.8916
Epoch 893/1000
19s 39ms/step - loss: 0.2479 - acc: 0.9390 - val_loss: 0.4224 - val_acc: 0.8914
Epoch 894/1000
19s 38ms/step - loss: 0.2485 - acc: 0.9419 - val_loss: 0.4281 - val_acc: 0.8903
Epoch 895/1000
19s 38ms/step - loss: 0.2449 - acc: 0.9425 - val_loss: 0.4278 - val_acc: 0.8873
Epoch 896/1000
19s 39ms/step - loss: 0.2453 - acc: 0.9427 - val_loss: 0.4281 - val_acc: 0.8903
Epoch 897/1000
19s 38ms/step - loss: 0.2502 - acc: 0.9401 - val_loss: 0.4210 - val_acc: 0.8919
Epoch 898/1000
19s 38ms/step - loss: 0.2494 - acc: 0.9399 - val_loss: 0.4239 - val_acc: 0.8909
Epoch 899/1000
19s 38ms/step - loss: 0.2475 - acc: 0.9422 - val_loss: 0.4238 - val_acc: 0.8929
Epoch 900/1000
19s 38ms/step - loss: 0.2475 - acc: 0.9416 - val_loss: 0.4256 - val_acc: 0.8885
Epoch 901/1000
19s 39ms/step - loss: 0.2439 - acc: 0.9416 - val_loss: 0.4240 - val_acc: 0.8910
Epoch 902/1000
19s 38ms/step - loss: 0.2470 - acc: 0.9407 - val_loss: 0.4253 - val_acc: 0.8905
Epoch 903/1000
19s 38ms/step - loss: 0.2433 - acc: 0.9420 - val_loss: 0.4210 - val_acc: 0.8920
Epoch 904/1000
19s 39ms/step - loss: 0.2434 - acc: 0.9427 - val_loss: 0.4239 - val_acc: 0.8900
Epoch 905/1000
19s 39ms/step - loss: 0.2463 - acc: 0.9408 - val_loss: 0.4223 - val_acc: 0.8914
Epoch 906/1000
19s 38ms/step - loss: 0.2455 - acc: 0.9408 - val_loss: 0.4255 - val_acc: 0.8909
Epoch 907/1000
19s 39ms/step - loss: 0.2421 - acc: 0.9426 - val_loss: 0.4230 - val_acc: 0.8916
Epoch 908/1000
19s 38ms/step - loss: 0.2448 - acc: 0.9412 - val_loss: 0.4216 - val_acc: 0.8891
Epoch 909/1000
19s 38ms/step - loss: 0.2439 - acc: 0.9422 - val_loss: 0.4255 - val_acc: 0.8896
Epoch 910/1000
19s 38ms/step - loss: 0.2439 - acc: 0.9416 - val_loss: 0.4298 - val_acc: 0.8902
Epoch 911/1000
19s 39ms/step - loss: 0.2430 - acc: 0.9419 - val_loss: 0.4245 - val_acc: 0.8892
Epoch 912/1000
19s 39ms/step - loss: 0.2432 - acc: 0.9421 - val_loss: 0.4245 - val_acc: 0.8908
Epoch 913/1000
19s 39ms/step - loss: 0.2444 - acc: 0.9420 - val_loss: 0.4239 - val_acc: 0.8911
Epoch 914/1000
19s 39ms/step - loss: 0.2449 - acc: 0.9418 - val_loss: 0.4221 - val_acc: 0.8918
Epoch 915/1000
19s 39ms/step - loss: 0.2445 - acc: 0.9415 - val_loss: 0.4293 - val_acc: 0.8876
Epoch 916/1000
19s 39ms/step - loss: 0.2445 - acc: 0.9412 - val_loss: 0.4254 - val_acc: 0.8889
Epoch 917/1000
19s 39ms/step - loss: 0.2452 - acc: 0.9405 - val_loss: 0.4275 - val_acc: 0.8877
Epoch 918/1000
19s 39ms/step - loss: 0.2446 - acc: 0.9400 - val_loss: 0.4255 - val_acc: 0.8894
Epoch 919/1000
19s 38ms/step - loss: 0.2456 - acc: 0.9398 - val_loss: 0.4240 - val_acc: 0.8930
Epoch 920/1000
19s 38ms/step - loss: 0.2444 - acc: 0.9412 - val_loss: 0.4228 - val_acc: 0.8909
Epoch 921/1000
19s 39ms/step - loss: 0.2431 - acc: 0.9422 - val_loss: 0.4204 - val_acc: 0.8900
Epoch 922/1000
19s 39ms/step - loss: 0.2441 - acc: 0.9403 - val_loss: 0.4206 - val_acc: 0.8915
Epoch 923/1000
19s 38ms/step - loss: 0.2431 - acc: 0.9415 - val_loss: 0.4196 - val_acc: 0.8918
Epoch 924/1000
19s 38ms/step - loss: 0.2437 - acc: 0.9419 - val_loss: 0.4246 - val_acc: 0.8885
Epoch 925/1000
19s 38ms/step - loss: 0.2414 - acc: 0.9414 - val_loss: 0.4226 - val_acc: 0.8898
Epoch 926/1000
19s 39ms/step - loss: 0.2386 - acc: 0.9429 - val_loss: 0.4181 - val_acc: 0.8909
Epoch 927/1000
19s 38ms/step - loss: 0.2411 - acc: 0.9416 - val_loss: 0.4233 - val_acc: 0.8912
Epoch 928/1000
19s 39ms/step - loss: 0.2432 - acc: 0.9414 - val_loss: 0.4277 - val_acc: 0.8889
Epoch 929/1000
19s 39ms/step - loss: 0.2416 - acc: 0.9415 - val_loss: 0.4297 - val_acc: 0.8875
Epoch 930/1000
19s 39ms/step - loss: 0.2427 - acc: 0.9415 - val_loss: 0.4267 - val_acc: 0.8879
Epoch 931/1000
19s 39ms/step - loss: 0.2408 - acc: 0.9426 - val_loss: 0.4289 - val_acc: 0.8884
Epoch 932/1000
19s 39ms/step - loss: 0.2408 - acc: 0.9415 - val_loss: 0.4275 - val_acc: 0.8882
Epoch 933/1000
19s 39ms/step - loss: 0.2393 - acc: 0.9421 - val_loss: 0.4283 - val_acc: 0.8890
Epoch 934/1000
19s 38ms/step - loss: 0.2392 - acc: 0.9424 - val_loss: 0.4261 - val_acc: 0.8884
Epoch 935/1000
19s 38ms/step - loss: 0.2407 - acc: 0.9421 - val_loss: 0.4295 - val_acc: 0.8863
Epoch 936/1000
19s 39ms/step - loss: 0.2447 - acc: 0.9418 - val_loss: 0.4253 - val_acc: 0.8879
Epoch 937/1000
19s 39ms/step - loss: 0.2371 - acc: 0.9427 - val_loss: 0.4255 - val_acc: 0.8892
Epoch 938/1000
19s 39ms/step - loss: 0.2400 - acc: 0.9422 - val_loss: 0.4239 - val_acc: 0.8894
Epoch 939/1000
19s 39ms/step - loss: 0.2407 - acc: 0.9413 - val_loss: 0.4246 - val_acc: 0.8899
Epoch 940/1000
19s 39ms/step - loss: 0.2413 - acc: 0.9424 - val_loss: 0.4252 - val_acc: 0.8894
Epoch 941/1000
19s 38ms/step - loss: 0.2415 - acc: 0.9415 - val_loss: 0.4256 - val_acc: 0.8911
Epoch 942/1000
19s 38ms/step - loss: 0.2373 - acc: 0.9431 - val_loss: 0.4280 - val_acc: 0.8876
Epoch 943/1000
19s 39ms/step - loss: 0.2385 - acc: 0.9422 - val_loss: 0.4260 - val_acc: 0.8885
Epoch 944/1000
19s 39ms/step - loss: 0.2376 - acc: 0.9424 - val_loss: 0.4200 - val_acc: 0.8904
Epoch 945/1000
19s 39ms/step - loss: 0.2392 - acc: 0.9422 - val_loss: 0.4242 - val_acc: 0.8915
Epoch 946/1000
19s 39ms/step - loss: 0.2407 - acc: 0.9414 - val_loss: 0.4230 - val_acc: 0.8907
Epoch 947/1000
19s 39ms/step - loss: 0.2383 - acc: 0.9432 - val_loss: 0.4200 - val_acc: 0.8893
Epoch 948/1000
19s 39ms/step - loss: 0.2386 - acc: 0.9430 - val_loss: 0.4262 - val_acc: 0.8881
Epoch 949/1000
19s 38ms/step - loss: 0.2386 - acc: 0.9416 - val_loss: 0.4197 - val_acc: 0.8903
Epoch 950/1000
19s 38ms/step - loss: 0.2371 - acc: 0.9431 - val_loss: 0.4196 - val_acc: 0.8883
Epoch 951/1000
19s 38ms/step - loss: 0.2363 - acc: 0.9429 - val_loss: 0.4231 - val_acc: 0.8875
Epoch 952/1000
19s 39ms/step - loss: 0.2369 - acc: 0.9426 - val_loss: 0.4250 - val_acc: 0.8924
Epoch 953/1000
19s 39ms/step - loss: 0.2341 - acc: 0.9428 - val_loss: 0.4218 - val_acc: 0.8898
Epoch 954/1000
19s 39ms/step - loss: 0.2349 - acc: 0.9438 - val_loss: 0.4262 - val_acc: 0.8906
Epoch 955/1000
19s 39ms/step - loss: 0.2365 - acc: 0.9425 - val_loss: 0.4246 - val_acc: 0.8875
Epoch 956/1000
19s 39ms/step - loss: 0.2355 - acc: 0.9432 - val_loss: 0.4250 - val_acc: 0.8886
Epoch 957/1000
19s 38ms/step - loss: 0.2395 - acc: 0.9412 - val_loss: 0.4229 - val_acc: 0.8897
Epoch 958/1000
19s 39ms/step - loss: 0.2374 - acc: 0.9433 - val_loss: 0.4200 - val_acc: 0.8897
Epoch 959/1000
19s 39ms/step - loss: 0.2362 - acc: 0.9428 - val_loss: 0.4183 - val_acc: 0.8929
Epoch 960/1000
19s 39ms/step - loss: 0.2382 - acc: 0.9415 - val_loss: 0.4205 - val_acc: 0.8900
Epoch 961/1000
19s 38ms/step - loss: 0.2365 - acc: 0.9421 - val_loss: 0.4164 - val_acc: 0.8894
Epoch 962/1000
19s 39ms/step - loss: 0.2351 - acc: 0.9429 - val_loss: 0.4170 - val_acc: 0.8911
Epoch 963/1000
19s 39ms/step - loss: 0.2378 - acc: 0.9416 - val_loss: 0.4160 - val_acc: 0.8890
Epoch 964/1000
19s 38ms/step - loss: 0.2349 - acc: 0.9422 - val_loss: 0.4220 - val_acc: 0.8888
Epoch 965/1000
19s 38ms/step - loss: 0.2340 - acc: 0.9426 - val_loss: 0.4218 - val_acc: 0.8891
Epoch 966/1000
19s 39ms/step - loss: 0.2350 - acc: 0.9451 - val_loss: 0.4210 - val_acc: 0.8891
Epoch 967/1000
19s 38ms/step - loss: 0.2354 - acc: 0.9426 - val_loss: 0.4207 - val_acc: 0.8877
Epoch 968/1000
19s 39ms/step - loss: 0.2362 - acc: 0.9425 - val_loss: 0.4201 - val_acc: 0.8899
Epoch 969/1000
19s 38ms/step - loss: 0.2360 - acc: 0.9433 - val_loss: 0.4179 - val_acc: 0.8904
Epoch 970/1000
19s 39ms/step - loss: 0.2344 - acc: 0.9425 - val_loss: 0.4252 - val_acc: 0.8859
Epoch 971/1000
19s 38ms/step - loss: 0.2386 - acc: 0.9420 - val_loss: 0.4170 - val_acc: 0.8902
Epoch 972/1000
19s 39ms/step - loss: 0.2328 - acc: 0.9424 - val_loss: 0.4225 - val_acc: 0.8882
Epoch 973/1000
19s 38ms/step - loss: 0.2360 - acc: 0.9425 - val_loss: 0.4192 - val_acc: 0.8875
Epoch 974/1000
19s 38ms/step - loss: 0.2357 - acc: 0.9421 - val_loss: 0.4181 - val_acc: 0.8891
Epoch 975/1000
19s 38ms/step - loss: 0.2396 - acc: 0.9398 - val_loss: 0.4192 - val_acc: 0.8890
Epoch 976/1000
19s 38ms/step - loss: 0.2340 - acc: 0.9423 - val_loss: 0.4226 - val_acc: 0.8874
Epoch 977/1000
19s 38ms/step - loss: 0.2352 - acc: 0.9417 - val_loss: 0.4165 - val_acc: 0.8914
Epoch 978/1000
19s 39ms/step - loss: 0.2317 - acc: 0.9425 - val_loss: 0.4198 - val_acc: 0.8895
Epoch 979/1000
19s 39ms/step - loss: 0.2323 - acc: 0.9436 - val_loss: 0.4183 - val_acc: 0.8903
Epoch 980/1000
19s 39ms/step - loss: 0.2324 - acc: 0.9423 - val_loss: 0.4203 - val_acc: 0.8888
Epoch 981/1000
19s 38ms/step - loss: 0.2361 - acc: 0.9408 - val_loss: 0.4165 - val_acc: 0.8897
Epoch 982/1000
19s 38ms/step - loss: 0.2305 - acc: 0.9438 - val_loss: 0.4190 - val_acc: 0.8921
Epoch 983/1000
19s 38ms/step - loss: 0.2295 - acc: 0.9445 - val_loss: 0.4186 - val_acc: 0.8916
Epoch 984/1000
19s 38ms/step - loss: 0.2322 - acc: 0.9429 - val_loss: 0.4198 - val_acc: 0.8898
Epoch 985/1000
19s 38ms/step - loss: 0.2323 - acc: 0.9431 - val_loss: 0.4230 - val_acc: 0.8909
Epoch 986/1000
19s 38ms/step - loss: 0.2330 - acc: 0.9431 - val_loss: 0.4193 - val_acc: 0.8891
Epoch 987/1000
19s 39ms/step - loss: 0.2323 - acc: 0.9422 - val_loss: 0.4195 - val_acc: 0.8916
Epoch 988/1000
19s 39ms/step - loss: 0.2318 - acc: 0.9426 - val_loss: 0.4185 - val_acc: 0.8900
Epoch 989/1000
19s 39ms/step - loss: 0.2328 - acc: 0.9412 - val_loss: 0.4197 - val_acc: 0.8923
Epoch 990/1000
19s 39ms/step - loss: 0.2329 - acc: 0.9417 - val_loss: 0.4133 - val_acc: 0.8909
Epoch 991/1000
19s 39ms/step - loss: 0.2303 - acc: 0.9431 - val_loss: 0.4166 - val_acc: 0.8911
Epoch 992/1000
19s 38ms/step - loss: 0.2300 - acc: 0.9434 - val_loss: 0.4202 - val_acc: 0.8914
Epoch 993/1000
19s 39ms/step - loss: 0.2359 - acc: 0.9406 - val_loss: 0.4194 - val_acc: 0.8882
Epoch 994/1000
19s 39ms/step - loss: 0.2295 - acc: 0.9430 - val_loss: 0.4191 - val_acc: 0.8905
Epoch 995/1000
19s 39ms/step - loss: 0.2283 - acc: 0.9442 - val_loss: 0.4219 - val_acc: 0.8877
Epoch 996/1000
19s 38ms/step - loss: 0.2299 - acc: 0.9426 - val_loss: 0.4232 - val_acc: 0.8877
Epoch 997/1000
19s 38ms/step - loss: 0.2315 - acc: 0.9433 - val_loss: 0.4219 - val_acc: 0.8898
Epoch 998/1000
19s 39ms/step - loss: 0.2311 - acc: 0.9419 - val_loss: 0.4189 - val_acc: 0.8889
Epoch 999/1000
19s 39ms/step - loss: 0.2278 - acc: 0.9436 - val_loss: 0.4226 - val_acc: 0.8899
Epoch 1000/1000
19s 38ms/step - loss: 0.2294 - acc: 0.9432 - val_loss: 0.4192 - val_acc: 0.8898
Train loss: 0.2049155475348234
Train accuracy: 0.9527800017595291
Test loss: 0.4191611827909946
Test accuracy: 0.8898000001907349

此外还发现,如下图所示,在学习率为0.01的时候,原本loss都不下降了,一直在0.35左右波动;当学习率下降为0.001的时候,loss瞬间降到了0.32,紧接着又降到了0.29。似乎降低学习率很有利于loss下降。

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, Date of Publication: 13 February 2020.

https://ieeexplore.ieee.org/document/8998530

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
作者已关闭评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档