core.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Neural-Network 作者: yzldw333 项目源码 文件源码
def unRollImagesForConv(self,index):
        '''?????index?????
            ?? ?width*?height,   ?????*?channel?  ????size??????
        '''
        i = index
        old_images = self.last_layer.images
        m,old_channel,old_height,old_width = old_images.shape
        newData = []
        #Process unroll the data
        for h in range(0,old_height-self.squareSize+1,self.stride):
            for w in range(0,old_width-self.squareSize+1,self.stride):
                tmp = []
                for c in range(old_channel):
                    tmp.append(old_images[i,c,h:h+self.squareSize,w:w+self.squareSize].reshape(1,self.squareSize**2))
                    #h,w?????,??????????,??old_channel   *   squaireSize?????
                tmp = np.array(tmp).reshape(1,self.squareSize**2*old_channel)
                #?????reshape,????????,????newData
                newData.append(tmp)
                #??????????????????,?????????
        newData = np.array(newData).reshape(self.width*self.height,self.squareSize**2*old_channel)
        return newData
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号