コードソース:https : //github.com/eriklindernoren/ML-From-Scratch
畳み込みニューラルネットワークでのConv2D(ストライド、パディング付き)の具体的な実装:https ://www.cnblogs.com/xiximayou/p/12706576.html
アクティベーション機能の実装(シグモイド、softmax、tanh、relu、leakyrelu、elu、selu、softplus):https ://www.cnblogs.com/xiximayou/p/12713081.html
損失関数の定義(平均二乗誤差、クロスエントロピー損失):https : //www.cnblogs.com/xiximayou/p/12713198.html
オプティマイザーの実装(SGD、Nesterov、Adagrad、Adadelta、RMSprop、Adam):https ://www.cnblogs.com/xiximayou/p/12713594.html
畳み込み層の逆伝播プロセス:https : //www.cnblogs.com/xiximayou/p/12713930.html
完全に接続されたレイヤーの実装:https : //www.cnblogs.com/xiximayou/p/12720017.html
バッチ正規化レイヤーの実装:https : //www.cnblogs.com/xiximayou/p/12720211.html
プーリング層の実装:https : //www.cnblogs.com/xiximayou/p/12720324.html
padding2D実装:https ://www.cnblogs.com/xiximayou/p/12720454.html
フラットレイヤーの実装:https : //www.cnblogs.com/xiximayou/p/12720518.html
クラスUpSampling2D(Layer): "" " 入力の最近傍アップサンプリング データの行と列をそれぞれsize [0]とsize [1]で繰り返します パラメータ: ----------- サイズ:タプル (size_y、size_x) -各軸が繰り返される回数 。""」 DEF __init__(自己、サイズ=(2,2)、input_shape = なし): self.prev_shape = なし self.trainable = 真 self.size = サイズ self.input_shape = input_shape def forward_pass(self、X、training =True): self.prev_shape = X.shape #サイズで指定された とおりに各軸を繰り返します X_new = X.repeat(self.size [0]、axis = 2).repeat(self.size [1]、axis = 3 ) return X_new def backward_pass(self、accum_grad): #前の形状への入力をダウンサンプル accum_grad = accum_grad [:,:、:: self.size [0]、:: self.size [1 ]] return accum_grad def output_shape(self): チャネル、高さ、幅 = self.input_shape 戻りチャネル、self.size [0] *高さ、self.size [1] *幅
コアはnumpy.repeat()関数です。