You could do something like as in the code snippet pointed by the url for saving:
https://github.com/stencilman/deep_nets_iclr04/blob/3df388fda8d5e1aaf85e5d8daf2e317b68934c17/lib/train_machine.py#L473 https://github.com/stencilman/deep_nets_iclr04/blob/3df388fda8d5e1aaf85e5d8daf2e317b68934c17/lib/layer_blocks.py#L79 You could also use a wrapper like lasagne to get some high level functionality for training and testing your networks. On Mon, Sep 26, 2016 at 1:01 PM, Mallika Agarwal <[email protected]> wrote: > I scoured the internet and I can see that this question has been asked by > many users, but I'm still unable to understand how to do this. > > I have a simple network (as given in the CNN tutorial > <http://deeplearning.net/tutorial/lenet.html>), except modified to work > on 100*100 images, and a smaller dataset. > > This is basically > > 1. LeNetConvPoolLayer > 2. LeNetConvPoolLayer > 3. HiddenLayer > 4. LogisticRegression (outputs a 0 or 1). > > *1. (Logistically) How do I save the parameters? Do I save them for each > of the layers or do I simply save the shared variable "params"*? > params = layer3.params + layer2.params + layer1.params + layer0.params > > *2. Once saved, do I have to reconstruct this network in another script > using these params? If so, how do I use these params? I can't find any line > which assigns the params anywhere.* > > I would like to have the predicted class and the confidence of the > prediction, to be able to perform verification for face recognition. > > > > *3. If I want to predict the class for every image, do I simply change the > batch size to 1? Where can I actually print this prediction? There is a > function call* > test_losses = [ > test_model(i) > for i in range(n_test_batches) > ] > > *which is defined before as * > > # create a function to compute the mistakes that are made by the model > test_model = theano.function( > [index], > layer3.errors(y), > givens={ > x: test_set_x[index * batch_size: (index + 1) * batch_size], > y: test_set_y[index * batch_size: (index + 1) * batch_size] > } > ) > > *I can't understand where the class is actually being predicted/which > variable it is stored in. * > > > If anyone could help me out with even one of these questions, I'd be > *extremely* grateful! > Please let me know if I could provide any other info. > > > > -- > > --- > 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. > -- --- 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.
