title: Problem with parsing an image into a numpy array
body: <p>I am trying to pass some images to a numpy array for training a deep neural network. I am using cv2 and the code goes like this</p>
  <pre><code>def dataloader(filepath, subset):
      # Initiliaze return arrays - input of shape = HYPERPARAMETER
      global size
      if subset==&quot;train&quot;:
          size = 129
      elif subset==&quot;test&quot;:
          size = 18
      input_data=np.zeros((size,1024,1024,1))
      output_data=np.zeros((size,1024,1024,1))
      # Open file and create loop
      with open(filepath+&quot;annotation_&quot;+subset+&quot;.txt&quot;, &quot;r&quot;) as input_file:
          # Count to pass through the file
          count=0
          for line in input_file:
              line.split()
              input_data[count,:,:,0]=cv2.imread(filepath+str(line[0])+&quot;.jpg&quot;,cv2.IMREAD_GRAYSCALE)
  </code></pre>
  <p>but this way my input is all nan and i cannot get why. Shouldnt the image be passed on as the 2d format I need. Can anyone explain why this is happening?</p>