Commit 8ffcc2fa authored by Aysar's avatar Aysar Committed by pkulzc
Browse files

Allow loading png images in object detection jupyter notebook (#5269)

parent 8ff61153
...@@ -297,6 +297,8 @@ ...@@ -297,6 +297,8 @@
"source": [ "source": [
"def load_image_into_numpy_array(image):\n", "def load_image_into_numpy_array(image):\n",
" (im_width, im_height) = image.size\n", " (im_width, im_height) = image.size\n",
" if image.format == 'PNG':\n",
" image = image.convert('RGB')\n",
" return np.array(image.getdata()).reshape(\n", " return np.array(image.getdata()).reshape(\n",
" (im_height, im_width, 3)).astype(np.uint8)" " (im_height, im_width, 3)).astype(np.uint8)"
] ]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment