On Tue, Dec 20, 2016, Eric Huang wrote: > Thank you very much. > It is right but seems difficult to achieve.......
You could also try images2neibs, then apply normalization, then a dot product to simulate the convolution. Although it could be slower, and the gradient may not be implemented in all cases. > > 在 2016年12月21日星期三 UTC+8上午5:57:08,Pascal Lamblin写道: > > > > Hi, > > > > Not all implementations of convolutions used in Theano can be modified. > > For instance, cuDNN ones are defined externally, and we do not have the > > source code. > > > > In your case, you could probably copy / edit the CorrMM version, and add > > the normalization of patches before the call to im2col. You may actually > > have to reverse the role of image and kernel for that. > > Also, you would have to redefine the gradients as well. > > > > On Tue, Dec 20, 2016, Eric Huang wrote: > > > > > > > > > I wanna to normalize (substract mean, divide standard deviation) input > > in > > > each patch during convolution. > > > > > > > > > For example, > > > Input: (1,224, 224) > > > kernel: (64,5,5) > > > stride: 1 > > > During the calculation of the first feature map, I'd like to do the > > > following operations for each position: > > > feaMap[0, 0, 0] = conv( (Input[0, 0:5, 0:5] - mean)/std, kernel[0, :, :] > > ) > > > feaMap[0, 0, 1] = conv( (Input[0, 0:5, 1:6] - mean)/std, kernel[0, :, :] > > ) > > > feaMap[0, 0, 2] = conv( (Input[0, 0:5, 2:7] - mean)/std, kernel[0, :, :] > > ) > > > > > > ....... > > > where mean is a fix matrix of shape (1, 5, 5), std is a fix matrix of > > shape > > > (1, 5, 5). > > > > > > It is great cost if I write my own code to extract each patch, do > > > normalization then conduct convolution. So I just want to edit the conv > > > function to add "substract mean", "divide standard deviation" operation. > > > But it seems difficult to edit the conv function to achieve my goal. > > > > > > How can I achieve it ? Any idea? > > > > > > -- > > > > > > --- > > > You received this message because you are subscribed to the Google > > Groups "theano-users" group. > > > To unsubscribe from this group and stop receiving emails from it, send > > an email to [email protected] <javascript:>. > > > For more options, visit https://groups.google.com/d/optout. > > > > > > -- > > Pascal > > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "theano-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- Pascal -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
