-1

I'm using this tutorial as example to build my caffe custom training function. On section 15 there is the following code:

def train():
    niter = 200
    test_interval = 25 
    train_loss = zeros(niter)
    test_acc = zeros(int(np.ceil(niter / test_interval)))

    ### HERE ###
    output = zeros((niter, 8, 10))
    ###      ###

On line 8 there is an ndarray (output), what is the meaning of this code and it demensions. What is the meaning of (niter, 8, 10). Why niter, why 8 and why 10? Should I change this array according to my own data set? If yes, what dimension should I use? Can someone explain me it?

Shai
  • 111,146
  • 38
  • 238
  • 371
Carlos Porta
  • 1,224
  • 5
  • 19
  • 31

2 Answers2

2

If you read closely the tutorial you'll see that it deals with digits classification, hence the 10 classes. Moreover, they use a trick to tile 8 examples together (Section 11, near the In [11]:):

# we use a little trick to tile the first eight images

Hence the 8 dimension.

Section 15 shows an example of tracking the progress of the network. It saves the output prediction probability per iteration. There are 10 classes times 8 examples per iteration, and there are niter iterations to track. All this information is stored in the 3D output array.

Shai
  • 111,146
  • 38
  • 238
  • 371
1

It looks like a call to numpy.zeros where shape = (niter, 8, 10) which creates a 200 * 8 * 10 array of float 0.

Hugh Bothwell
  • 55,315
  • 8
  • 84
  • 99
  • Yeah, I understand it. What I do not know why, is why this ndarray has this dimension? Should I change it according to my own data set? – Carlos Porta Nov 25 '15 at 17:32