Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 带激光扫描的卷积网络-图像大小调整_Python_Image Processing_Neural Network_Theano_Lasagne - Fatal编程技术网

Python 带激光扫描的卷积网络-图像大小调整

Python 带激光扫描的卷积网络-图像大小调整,python,image-processing,neural-network,theano,lasagne,Python,Image Processing,Neural Network,Theano,Lasagne,我用千层面训练了一些神经网络和卷积网络,并用Python进行了大部分数据/图像预处理。不过,我希望将其中一些内容合并到我的千层面中,以使我的代码更加灵活 是否有可以调整输入图像大小的千层面?您可以使用nolearn.Lasagne.BatchIterator,而不是在一个层面上进行调整;在以下片段中,我将原始1D信号重新采样为1000点信号: from nolearn.lasagne import BatchIterator from scipy.signal import resample i

我用千层面训练了一些神经网络和卷积网络,并用Python进行了大部分数据/图像预处理。不过,我希望将其中一些内容合并到我的千层面中,以使我的代码更加灵活


是否有可以调整输入图像大小的千层面?

您可以使用
nolearn.Lasagne.BatchIterator
,而不是在一个层面上进行调整;在以下片段中,我将原始1D信号重新采样为1000点信号:

from nolearn.lasagne import BatchIterator
from scipy.signal import resample
import numpy as np

class ResampleIterator(BatchIterator):

    def __init__(self, batch_size, newSize):
        super(ResampleIterator, self).__init__(batch_size)
        self.newSize = newSize

    def transform(self, Xb, yb):
        X_new = resample(Xb, self.newSize, axis=2).astype(np.float32)    
        return X_new, yb


 myNet = NeuralNet(
 # define your usual other parameters (layers, etc) here

    # and these are the lines you are interested in:
    batch_iterator_train=CropIterator(batch_size=128, newSize=1000),
    batch_iterator_test=CropIterator(batch_size=128, newSize=1000),
    )

我不知道您是否使用过
nolearn
,但是,您可以阅读更多关于它的信息(安装、示例)

而不是在一个层中使用
nolearn.lasagne.BatchIterator
;在以下片段中,我将原始1D信号重新采样为1000点信号:

from nolearn.lasagne import BatchIterator
from scipy.signal import resample
import numpy as np

class ResampleIterator(BatchIterator):

    def __init__(self, batch_size, newSize):
        super(ResampleIterator, self).__init__(batch_size)
        self.newSize = newSize

    def transform(self, Xb, yb):
        X_new = resample(Xb, self.newSize, axis=2).astype(np.float32)    
        return X_new, yb


 myNet = NeuralNet(
 # define your usual other parameters (layers, etc) here

    # and these are the lines you are interested in:
    batch_iterator_train=CropIterator(batch_size=128, newSize=1000),
    batch_iterator_test=CropIterator(batch_size=128, newSize=1000),
    )
我不知道您是否使用过
nolearn
,但您可以阅读更多关于它的信息(安装,示例)