yolov3网格

grid_y = K.tile(K.reshape(K.arange(0, stop=grid_shape[0]), [-1, 1, 1, 1]),
        [1, grid_shape[1], 1, 1])
    
grid_x = K.tile(K.reshape(K.arange(0, stop=grid_shape[1]), [1, -1, 1, 1]),
        [grid_shape[0], 1, 1, 1])
          其中grid为相对于feature map左上角的偏移量。以13*13的feature map为例来说明box 中心点x,y以及宽高w,h的计算过程。

          K.arange(0, stop=grid_shape[0]) ---->[ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12]

          K.reshape(K.arange(0, stop=grid_shape[0]), [-1, 1, 1, 1]) ---->  -1表示为变化的维度,放在第一维度表示第一位维是变化的则 shape=[13,1,1,1]  一共包含13行值分别为0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12。

          具体形式如下:[ [ [ [ 0 ] ] ]

                                       ..........

                                        [ [ [12 ] ] ] ]

         grid_y = K.tile(K.reshape(K.arange(0, stop=grid_shape[0]), [-1, 1, 1, 1]),  [1, grid_shape[1], 1, 1]) ----> 表示在第二个维度重复13次   shape=[13,13,1,1]

        具体形式如下:[ [ [ [ 0 ] ]

                                        ...........

                                          [ [ 0 ] ]    重复13次
                                        [ [ [ 1 ] ]

                                        ............
                                          [ [ 1 ] ]    重复13次
                                        .............
                                        .............

                                       [ [ [ 12 ] ]

                                        ...............

                                          [ [12 ] ] ] ]

        同理可得到grid_x的具体形式:[ [ [ [  0 ] ]                 shape=[13,13,1,1]
                                                                       [ [  1 ] ]

                                                                      ............

                                                                       [ [12 ] ] ]

                                                                      .............

                                                                      .............

                                                                   [ [ [ [  0 ] ] 蓝色部分共重复了13次
                                                                       [ [  1 ] ]

                                                                      ............

                                                                      [ [ 12 ] ] ]        

                  grid最终形式为        [ [ [ [ 0  0 ] ]                           shape=[13,13,1,2]     
                                                           [ [ 1  0 ] ]     
                                                          ................
                                                           [ [12  1 ] ] ]   

                                                         [ [ [ 0  1 ] ]                    
                                                           [ [ 1  1 ] ]     
                                                          ................                                                                                                                      

                                                           [ [12  1] ] ]

                                                          ..................

                                                          ..................   

                                                          [ [ [ 0  12 ] ]                    
                                                           [ [ 1  12 ] ]     
                                                          ................                                                                                                                      

                                                           [ [12  12] ] ]
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值