在Theano中进行3D滑动窗口操作? [英] 3d sliding window operation in Theano?

查看:87
本文介绍了在Theano中进行3D滑动窗口操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL.DR.是否有 theano.tensor.nnet.neighbours.images2neibs的3维友好实现? ?

TL.DR. Is there a 3-dimensional friendly implementation of theano.tensor.nnet.neighbours.images2neibs?

我想使用神经网络对体积(NxNxN)进行体素分类,该神经网络接收nxnxn图像,其中N> n.要对体积中的每个体素进行分类,我必须遍历每个体素.对于每次迭代,我都会获取邻域体素并将其传递给神经网络,作为输入.这只是一个滑动窗口操作,该操作就是神经网络.

I would like to perform voxel-wise classification of a volume (NxNxN) using a neural network that takes in a nxnxn image, where N>n. To classify each voxel in the volume, I have to iterate through each voxel. For each iterration, I obtain and pass the neighborhood voxels as the input to the neural network. This is simply a sliding window operation, which the operation is the neural network.

虽然我的神经网络是在Theano中实现的,但是滑动窗口的实现是在python/numpy中的.由于这不是纯粹的Theano操作,因此分类需要花费永久时间(> 3小时)才能将所有体素分类为一个体积.对于2d滑动窗口操作,Theano有一个辅助方法theano.tensor.nnet.neighbours.images2neibs,对于3维图像有类似的实现吗?

While my neural network is implemented in Theano, the sliding window implementation is in python/numpy. Since this is not a pure Theano operation, the classification takes forever (> 3 hours) to classify all voxels in one volume. For 2d sliding window operation, Theano has a helper method, theano.tensor.nnet.neighbours.images2neibs, is there a similar implementation for 3-dimensional images?

现有现有的numpy解决方案( 1

There are existing numpy solutions (1 and 2) for n-d sliding window, both use np.lib.stride_tricks.as_strided to provide "views of the sliding window", thus preventing memory issues. In my implementation, the sliding window arrays are being passed from numpy (Cython) to Python and then to Theano. To boost performance, it's likely I have to bypass Python.

推荐答案

Eickenberg和Kastner的sklearn_theano.feature_extraction.overfeat中的OverfeatTransformer实用程序非常适合此操作.

Eickenberg and Kastner's OverfeatTransformer utility in sklearn_theano.feature_extraction.overfeat would be a good match for this operation, as mentioned by OP.

这篇关于在Theano中进行3D滑动窗口操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆