Introduction to keras

1.keras Explanation of batch normalization function parameter axis = 3: https://www.zhihu.com/question/318398221
tips:
The role of the BN layer: (1) accelerate convergence (2) control overfitting and can be used less Or not use Dropout and regularization (3) Reduce the network's insensitivity to initialization weights (4) Allow a larger learning rate
2. The zero padding operation in Keras: ZeroPadding2D ((3,3)) (X_input)
explained as follows: padding = (1,0), will add a row of 0 at the beginning and end of the row. For example, the original size is (None, 20,11,1), after padding it will become (None, 22,11,1). Padding
= (1,1), it will be at the front and end of the row and column Add a row of 0. For example, the original size is (None, 20, 11, 1), and after padding, it will become (None, 22, 13, 1).
Note: In the process of reproducing a network, the author uses a wide Convolution, that is, the length is N, and the size of the filter is w, then the result after convolution is N + W-1. This is consistent with the convolution operation in digital signal processing. There is no way to use the keras API, so just use padding.
Original link: https://blog.csdn.net/lujiandong1/article/details/54918320

3. Keras.layers.Dense detailed explanation: https://blog.csdn.net/weixin_42499236/article/details/84624195

4.Introduction to the use of keras model

5.note:
The variable names used by the Keras framework are different from the numpy and TensorFlow variables we used before. It does not create new variables (such as X, Z1, A1, Z2, A2, ...) at each step of forward propagation to facilitate calculations between different layers. In Keras, we use X to cover all values, without saving each layer of results, we only need the latest value, the only exception is X_input, we separate it because it is the input data, we want to be at the end Was used in the step of creating the model.

6.jupyter import and display pictures

img_path = 'smile.jpg'
img = image.load_img(img_path,target_size = (64,64))
imshow(img)

x = image.img_to_array(img)
x = np.expand_dims(x,axis = 0)
x = preprocess_input(x)

print(happy_model.predict(x))
Published 31 original articles · Likes0 · Visits 681

Guess you like

Origin blog.csdn.net/ballzy/article/details/105320680