[Keras 源码学习] MobileNetV2

本文详细探讨了Keras中MobileNetV2的实现,从Input层开始,深入到Conv2D层的使用,涉及keras.layers与tensorflow.ops.nn_ops的相关源码分析,为理解网络层的调用提供了清晰的路径。
摘要由CSDN通过智能技术生成

最近阅读到 Keras.backend.tensorflow_backend.py 。原由是 MobileNetV2 Keras 实现的学习,阅读的版本是https://github.com/JonathanCMitchell/mobilenet_v2_keras 的实现,官方的另一个指定版本。

MobilenetV2 基本上是平铺直叙,这一则是记录对实现过程中,各个网络层的调用细节。

  • Input
    Input 起始于 from keras.layers import Input ,该方法的具体实现在 keras.engine.input_layer.py 中。

    1. mobilenetv2.py
      from keras.layers import Input
      
    2. keras.layers.init.py
       from ..engine import InputLayer
      
    3. keras.engine.base.py
       from .input_layer import Input
      
    4. keras.engine.input_layer.py
      def Input(*):

    详细内容,下回分解。

  • Conv2D
    Conv2D 起始于 from keras.layers import Conv2D

    1. mobilenetv2.py

         x = Conv2D(first_block_filters,
                    kernel_size=3,
                    strides=(2, 2), padding='same',
                    use_bias=False, name='Conv1')(img_input)
      
    2. keras.layers.__init__.py

         from .convolutional import *
      
    3. keras.layers.convolutional.py

      	class Conv2D(_Conv):class _Conv(Layer):
          	def call(self, inputs):
      	        if self.rank == 2:
      	            outputs = K.conv2d(
      	                inputs,
      	                self.kernel,
      	                strides=self.strides,
      	                padding=self.padding,
      	                data_format=self.data_format,
      	                dilation_rate=self.dilation_rate)
      
    4. keras.backend.__init__.py

      	from .tensorflow_backend import *
      
    5. keras.backend.tensorflow_backend.py

      	def conv2d(x, kernel, strides=(1, 1), padding='valid',
      	           data_format=None
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值