title: TypeError: Cannot handle this data type: (1, 1, 3), <f4
body: <p>the temp_image is (600, 600, 3) with values ranging from 0 to 1.</p>
  
  <pre><code>def pro_process(temp_img, input_size):
      img = np.asarray(temp_img).astype('float32')
      img = np.array(Image.fromarray(img).resize((input_size, input_size)).convert(3))
      return img
  </code></pre>
  
  <p>It gives the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "S:\Program Files\Python36\lib\site-packages\PIL\Image.py", line 2681, in fromarray
      mode, rawmode = _fromarray_typemap[typekey]
  KeyError: ((1, 1, 3), '&lt;f4')
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "H:\OneDrive\synchronization code\Developing collection\Python\MNet_DeepCDR-master\mnet_deep_cdr_ide\run\Step_3_MNet_test.py", line 56, in &lt;module&gt;
      temp_img = pro_process(Disc_flat, CDRSeg_size)
    File "S:\Program Files\Python36\lib\site-packages\mnet_deep_cdr\mnet_utils.py", line 18, in pro_process
      img = np.array(Image.fromarray(img).resize((input_size, input_size)).convert(3))
    File "S:\Program Files\Python36\lib\site-packages\PIL\Image.py", line 2683, in fromarray
      raise TypeError("Cannot handle this data type: %s, %s" % typekey)
  TypeError: Cannot handle this data type: (1, 1, 3), &lt;f4
  </code></pre>
  
  <p>project Link: <a href="https://github.com/HzFu/MNet_DeepCDR" rel="noreferrer">https://github.com/HzFu/MNet_DeepCDR</a></p>
  
  <p>What's the error and how to fix it?</p>
  
  <p>according to this link:<a href="https://stackoverflow.com/questions/55319949/pil-typeerror-cannot-handle-this-data-type">PIL TypeError: Cannot handle this data type</a>I have updated my code, but there still have an error</p>
  
  <pre><code>def pro_process(temp_img, input_size):
  print(temp_img.shape)
  img = np.asarray(temp_img).astype('float32')
  img = np.array(Image.fromarray((img * 255).astype(np.uint8)).resize((input_size, input_size)).convert(3))
  return img
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "H:\OneDrive\synchronization code\Developing collection\Python\MNet_DeepCDR-master\mnet_deep_cdr_ide\run\Step_3_MNet_test.py", line 56, in &lt;module&gt;
    temp_img = pro_process(Disc_flat, CDRSeg_size)
    File "S:\Program Files\Python36\lib\site-packages\mnet_deep_cdr\mnet_utils.py", line 18, in pro_process
    img = np.array(Image.fromarray((img * 255).astype(np.uint8)).resize((input_size, input_size)).convert(3))
    File "S:\Program Files\Python36\lib\site-packages\PIL\Image.py", line 995, in convert
    im = self.im.convert(mode, dither)
   TypeError: argument 1 must be str, not int
  </code></pre>