title: Get a ValueError when converting an array of images into float
body: <p>I have a list of images of various dimensions:</p>
  <pre><code>images = []
  for direct in directory:
  
      img = cv2.imread(direct)
      img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
      images.append(img)
  </code></pre>
  <p>I intend to normalise the images therefore I should first convert the array images into float by <code>x = np.asarray(images).astype(np.float32)</code>, but I get the following error:</p>
  <pre><code>TypeError                                 Traceback (most recent call last)
  TypeError: only size-1 arrays can be converted to Python scalars
  
  The above exception was the direct cause of the following exception:
  
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-33-6b9623418638&gt; in &lt;module&gt;
  ----&gt; 1 x = np.asarray(images).astype(np.float32)
  
  ValueError: setting an array element with a sequence.
  </code></pre>
  <p>The error corresponds to the <code>astype(np.float32)</code>, how do I fix it?</p>