Comments (6)
Thanks for the report. I have a feeling this was caused by recent changes to the Pool2DLayer API. Unfortunately I won't be able to investigate further for a few days, but if you have a chance try adding ignore_border=False
to the arguments for each PoolLayer
call.
from recipes.
It worked, man \o/, thanks! Just adding ignore_border=False
to the pool layers as you said just made the code work perfectly
And OMG, what a awesome library, its concept is beautiful... just beautiful =)
net = {}
net['input'] = InputLayer((None, 3, 224, 224))
net['conv1'] = ConvLayer(net['input'], num_filters=96, filter_size=7, stride=2)
net['norm1'] = NormLayer(net['conv1'], alpha=0.0001) # caffe has alpha = alpha * pool_size
net['pool1'] = PoolLayer(net['norm1'], pool_size=3, stride=3, ignore_border=False)
net['conv2'] = ConvLayer(net['pool1'], num_filters=256, filter_size=5)
net['pool2'] = PoolLayer(net['conv2'], pool_size=2, stride=2, ignore_border=False)
net['conv3'] = ConvLayer(net['pool2'], num_filters=512, filter_size=3, pad=1)
net['conv4'] = ConvLayer(net['conv3'], num_filters=512, filter_size=3, pad=1)
net['conv5'] = ConvLayer(net['conv4'], num_filters=512, filter_size=3, pad=1)
net['pool5'] = PoolLayer(net['conv5'], pool_size=3, stride=3, ignore_border=False)
net['fc6'] = DenseLayer(net['pool5'], num_units=4096)
net['drop6'] = DropoutLayer(net['fc6'], p=0.5)
net['fc7'] = DenseLayer(net['drop6'], num_units=4096)
net['drop7'] = DropoutLayer(net['fc7'], p=0.5)
net['fc8'] = DenseLayer(net['drop7'], num_units=1000, nonlinearity=lasagne.nonlinearities.softmax)
output_layer = net['fc8']
from recipes.
I have a feeling this was caused by recent changes to the Pool2DLayer API.
Right... we should update it!
Just adding
ignore_border=False
to the pool layers as you said just made the code work perfectly
Note that you will still get wrong predictions when replacing a Conv2DDNNLayer
with a ConvLayer
! The Conv2DDNNLayer
has a flip_filters
keyword argument which defaults to False
: http://lasagne.readthedocs.org/en/latest/modules/layers/dnn.html#lasagne.layers.dnn.Conv2DDNNLayer.
So by default, it will compute a correlation, not a convolution. The Conv2DLayer
does not have this keyword argument, it will always compute a convolution. To fix this, you will need to explicitly flip the convolution filters after loading everything:
for k, layer in net:
if k.startswith('conv'):
layer.W.set_value(np.asarray(layer.W.get_value())[:,:,::-1,::-1])
from recipes.
Right... we should update it!
While we're at it, the following should change as well:
# We need a recent theano version for this to work
assert theano.__version__ >= '0.7.0.dev-512c2c16ac1c7b91d2db3849d8e7f384b524d23b'
class AveragePool2DLayer(lasagne.layers.MaxPool2DLayer):
For one, the version check doesn't work this way, because SHA1 sums are not following any particular order. The next commit's version string may be (lexicographically) smaller.
And secondly, the subclass isn't needed any more since you added the Pool2DLayer
.
from recipes.
For one, the version check doesn't work this way, because SHA1 sums are not following any particular order. The next commit's version string may be (lexicographically) smaller.
Yeah, I realized this during the Theano version debate but hadn't got around to fixing it yet. As far as I know, there's no way to actually version test Theano reliably, right?
from recipes.
As far as I know, there's no way to actually version test Theano reliably, right?
Correct. We just have to rely on people following Lasagne's installation instructions. I guess we shouldn't do additional version checks in Recipes then, unless a particular Recipe requires a more recent version of Theano than Lasagne. (In that case, if possible, I'd suggest to check for the presence of the required feature, rather than the version string.)
from recipes.
Related Issues (20)
- 3D UNet implementation HOT 7
- reason behind low value of parameters in VGG19 HOT 1
- error when set values for vgg-19 HOT 2
- modelzoo resnet50.py incompatible to Python 3 HOT 3
- Implementation of Convolutional Spatial Transformer and Siamese network HOT 3
- no sandbox.cuda
- Bad argument to Theano: No. of dimensions changes in the error after reshaping
- Question not an Issue: fliping the arrays HOT 1
- cifar100 with resnet HOT 1
- pretrained network for small images HOT 1
- https://s3.amazonaws.com/lasagne/recipes/pretrained/imagenet/vgg16.pkl HOT 6
- vgg16.pkl without aws cli
- Need help with S3 Browser based downloads HOT 1
- Dice coeff is not changing since the first epoch and binary accuracy changes and is increased to 1?
- Problem with op.grad in OpFromGraph - Guided Backpropagation
- Wrong order of stride and pad arguments in build_simple_block HOT 3
- Broken links in Video features with C3D.ipynb example HOT 5
- Training C3D
- Wrong pretrained weights for UNet example HOT 1
- DICE coefficient loss function HOT 23
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from recipes.