title: Lua/ Torch - Error while creating train.t7 and test.t7 files using custom data set
body: <p>I am trying to feed my own dataset to the CNN model I created. The code to create the training and testing <code>.t7</code> files is uploaded <a href="https://github.com/syamprasadkr/learning_torch/blob/master/create_t7.lua" rel="nofollow noreferrer">here</a>.</p>
  
  <p>I tested this code by creating a <code>train_set.t7</code> of 5000 images and <code>test_set.t7</code> of 500 images. Everything went well and I was able to load the images to the CNN model. Then I tried creating another set of <code>.t7</code> files from a larger dataset. I would like to explain a bit about the organization of the dataset. There is a <code>ROOT</code> folder called <code>data</code> (in the code, look for <code>ROOT</code>). There are two sub folders in it: <code>train</code> and <code>test</code>. Each of these sub folders are divided into 5 different folders named: <code>1</code>, <code>2</code>, <code>3</code>, <code>4</code> and <code>5</code>. Each of these folders have around 70,000 images in the case of <code>train</code>. </p>
  
  <p>The problem is that my code throws the following error after adding all the files from <code>data/train/1</code>:</p>
  
  <pre><code> /home/ubuntu/torch/install/bin/luajit: ...e/ubuntu/torch/install/share/lua/5.1/torchx/indexdir.lua:53: attempt to perform arithmetic on a nil value
  stack traceback:
      ...e/ubuntu/torch/install/share/lua/5.1/torchx/indexdir.lua:53: in function 'indexdir'
      create_t7.lua:25: in main chunk
      [C]: in function 'dofile'
      ...untu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
      [C]: at 0x0000cff9
  </code></pre>
  
  <p>I tried changing the order of folders, but it didn't help. What does this error indicate? Thanks in advance.</p>