Нейрондық желілердің негізгі түсінігі



Pdf көрінісі
бет34/37
Дата31.12.2021
өлшемі1,08 Mb.
#21770
1   ...   29   30   31   32   33   34   35   36   37
Б қосымшасының жалғасы

 

 

faces = np.asarray(faces) 



faces = np.expand_dims(faces) 

emotions = pd.get_dummies(data['emotion']).as_matrix() 

return faces, emotions 

def preprocess_input(x, v2=True): 

    x = x.astype('float32') 

    x = x / 255 

    if v2: 

        x = x - 0.5 

        x = x * 2 

    return x 

data_generator = ImageDataGenerator( 

featurewise_center=False, 

featurewise_std_normalization=False, 

rotation_range=10, 

width_shift_range=0.1, 

height_shift_range=0.1, 

zoom_range=.1, 

horizontal_flip=True) 

 

model = mini_XCEPTION(input_shape, num_classes) 



regularization = l2(l2_regularization) 

 

img_input = Input(input_shape) 



x = Conv2D(8, (3, 3), strides=(1, 1), kernel_regularizer=regularization, 

use_bias=False)(img_input) 

x = BatchNormalization()(x) 

x = Activation('relu')(x) 

x = Conv2D(8, (3, 3), strides=(1, 1), kernel_regularizer=regularization,  

use_bias=False)(x) 

x = BatchNormalization()(x) 

x = Activation('relu')(x) 

residual  =  Conv2D(16,  (1,  1),  strides  =  (2,  2),  padding  =  'same',  use_bias  = 

False)(x) 

residual = BatchNormalization()(residual) 

x  =  SeparableConv2D(16,  (3,  3),  padding='same',  kernel_regularizer  = 

regularization, use_bias = False)(x) 

x = BatchNormalization()(x) 

x = Activation('relu')(x) 

x  =  SeparableConv2D(16,  (3,  3),  padding='same',  kernel_regularizer  = 

regularization, use_bias = False)(x) 

x = BatchNormalization()(x) 




43

 



Достарыңызбен бөлісу:
1   ...   29   30   31   32   33   34   35   36   37




©emirsaba.org 2024
әкімшілігінің қараңыз

    Басты бет