kaggle_diabetic
kaggle_diabetic copied to clipboard
lasagne and nolearn version
When I run this code I get following error which I believe is happening because of version conflict of lasagne or nolearn between build and present version. Could you tell me what version or commit-point of lasagne and nolearn you have used in this project.
File "/home/tanay/src/lasagne/lasagne/layers/conv.py", line 391, in init super(Conv2DLayer, self).init(incoming, **kwargs)
TypeError: Failed to instantiate <class 'lasagne.layers.conv.Conv2DLayer'> with args {'b': <lasagne.init.Constant object at 0x7fab337e74d0>, 'incoming': <lasagne.layers.input.InputLayer object at 0x7fab31f54390>, 'name': 'conv2d1', 'nonlinearity': <lasagne.nonlinearities.LeakyRectify object at 0x7fab3b5e0250>, 'filter_size': (4, 4), 'stride': (2, 2), 'W': <lasagne.init.Orthogonal object at 0x7fab337e7450>, 'num_filters': 32, 'untie_biases': True, 'border_mode': 'same'}. Maybe parameter names have changed?
Are you using the nolearn and lasagne versions specified in the requirements.txt
file? Could you post the full output you're getting when running the script?
@sveitser thanks,it seems to be coming from some other direction.I used your requirements.txt after your suggestion and still got this error.Actually I'm trying this program on some other pictures after changing the necessary parameters in config.So seems like it's not version issue. failed to load CUDNN backend failed to load CUDAConvNet backend using CPU backend {'aug_params': {'allow_stretch': True, 'do_flip': True, 'rotation_range': (0, 360), 'shear_range': (0, 0), 'translation_range': (-40, 40), 'zoom_range': (0.8695652173913044, 1.15)}, 'balance_ratio': 0.975, 'balance_weights': array([ 1.36094537, 14.3782235 , 6.63756614, 40.23596793, 49.61299435]), 'batch_size_test': 8, 'batch_size_train': 48, 'final_balance_weights': array([ 1., 2., 2., 2., 2.]), 'h': 448, 'name': 'c_512_4x4_32', 'schedule': {0: 0.003, 150: 0.0003, 220: 3e-05, 251: 'stop'}, 'sigma': 0.25, 'test_dir': 'data/test_res', 'train_dir': 'data/train_res', 'w': 448, 'weight_decay': 0.0005} Traceback (most recent call last):
File "
File "/home/tanay/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile execfile(filename, namespace)
File "/home/tanay/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile builtins.execfile(filename, *where)
File "/home/tanay/Documents/kaggle_diabetic/train_nn.py", line 50, in
File "/home/tanay/anaconda/lib/python2.7/site-packages/click/core.py", line 610, in call return self.main(_args, *_kwargs)
File "/home/tanay/anaconda/lib/python2.7/site-packages/click/core.py", line 590, in main rv = self.invoke(ctx)
File "/home/tanay/anaconda/lib/python2.7/site-packages/click/core.py", line 782, in invoke return ctx.invoke(self.callback, **ctx.params)
File "/home/tanay/anaconda/lib/python2.7/site-packages/click/core.py", line 416, in invoke return callback(_args, *_kwargs)
File "/home/tanay/Documents/Calscan/kaggle_diabetic/train_nn.py", line 41, in main net.load_params_from(weights_from)
File "/home/tanay/Documents/kaggle_diabetic/src/nolearn-master/nolearn/lasagne/base.py", line 487, in load_params_from self.initialize()
File "nn.py", line 131, in initialize out = self._output_layer = self.initialize_layers()
File "/home/tanay/Documents/kaggle_diabetic/src/nolearn-master/nolearn/lasagne/base.py", line 270, in initialize_layers chain_exception(TypeError(msg), e)
File "/home/tanay/Documents/kaggle_diabetic/src/nolearn-master/nolearn/_compat.py", line 12, in chain_exception exec("raise exc1, None, sys.exc_info()[2]")
File "/home/tanay/Documents/kaggle_diabetic/src/nolearn-master/nolearn/lasagne/base.py", line 265, in initialize_layers layer = layer_factory(**layer_kw)
File "/home/tanay/Documents/kaggle_diabetic/src/lasagne-master/lasagne/layers/conv.py", line 375, in init super(Conv2DLayer, self).init(incoming, **kwargs)
TypeError: Failed to instantiate <class 'lasagne.layers.conv.Conv2DLayer'> with args {'b': <lasagne.init.Constant object at 0x7f1582c81b50>, 'incoming': <lasagne.layers.conv.Conv2DLayer object at 0x7f1582c27ed0>, 'name': 'conv2d2', 'nonlinearity': <lasagne.nonlinearities.LeakyRectify object at 0x7f158274f5d0>, 'filter_size': (4, 4), 'pad': 2, 'W': <lasagne.init.Orthogonal object at 0x7f1582c81b10>, 'num_filters': 32, 'untie_biases': True, 'border_mode': None}. Maybe parameter names have changed?
The master branch requires a GPU and CuDNN (see the readme). If you'd like to run the code on the CPU the deterministic
branch should work.
Will it be possible for you guys to point out what all are the modifications be required to handle lasagne.objectives.Objective deprication.For example I've changed the code in get_objective from
loss = super(RegularizedObjective, self).get_loss( input=input, target=target, aggregation=aggregation, deterministic=deterministic, **kwargs)
to loss = lasagne.objectives.aggregate( lasagne.objectives.categorical_crossentropy(input, target))
However that doesn't seem to be sufficient.
Sorry for the late reply. Have you tried the get_objective
function in the deterministic
branch?
https://github.com/sveitser/kaggle_diabetic/blob/deterministic/nn.py#L55-L73
After many years, I have a question regarding dependencies. I hope there is still someone active here. I am trying to run make_kaggle_solution.sh
.
I installed the dependencies by using requirements.txt, however, I get an error with numpy
numpy.dtype has the wrong size, try recompiling
The solution for this numpy error is to update the numpy library. However, if I update it, then I get an error with lasagne
File "/blah/blah/kaggle_diabetic_RAM/src/lasagne-dev/lasagne/layers/pool.py", line 6, in <module> from theano.tensor.signal import downsample ImportError: cannot import name downsample
If I update lasagne, theano, nolearn libraries, this is what I am getting...
File "/blah/blah/conda/envs/kaggle/lib/python2.7/site-packages/nolearn/lasagne/base.py", line 700, in fit self.train_loop(X, y, epochs=epochs) TypeError: train_loop() got an unexpected keyword argument epochs
Thank you very much for your help.