OSError: Cannot identify image file

02-07-2020 12:15 PM
New Contributor II


I'm trying to implement building footprint detection using Deep Learning as shown in this example Extracting Building Footprints From Drone Data | ArcGIS for Developers with my own data. But I'm getting the following error when I run the prepare_data() function.

The command I ran was 

The error persists even after reinstalling pillow 6.2.1.

Any ideas on how to resolve it? I'm using ArcGIS Pro 2.5.0. 

Thanks in advance.

Tags (1)
0 Kudos
5 Replies
by Anonymous User
Not applicable

This issue is caused by broken pillow install, try to use this command in your conda environment 

pip uninstall pillow


pip install pillow==6.2.1

this will fix your current environment 

Next time you are creating environment you can use this command

conda install -c esri arcgis fastai scikit-image pillow --no-pin

This will make sure you have correct version of pillow and other deep learning dependecies.

0 Kudos
New Contributor

Hi Sandeep, 

I've cloned the python environment and installed the frameworks using these steps install-deep-learning-frameworks. Afterwards, I've used the command (conda install -c esri arcgis fastai scikit-image pillow --no-pin) to correct the versions, and it actually updated two packages including pillow, but still getting the same error. Any further idea please? 

Thanks,  Ahmed


0 Kudos
New Contributor

I am getting the same issue here...

0 Kudos
New Contributor

I to am having the same error issue as the others, I tried uninstalling Pillow and reinstalling the updated version as well. I have tried it on a local as well as a network drive to see if there was an issue with permissions?? Any help would be much appreciated!

0 Kudos
by Anonymous User
Not applicable

Can you post a sample tile here and the metadata of the tile, it seems that the imagery you are using is multi spectral imagery. You need to convert multi spectral imagery to RGB format with datatype 8-bit unsigned, you can do it so by layer -> right click -> Export Raster and then check render and RGB options while exporting data. 


Also we have added experimental support for multi spectral data, you can trigger that by adding imagery_type='ms'  kwarg to prepare_data() method. You can directly used you training data this way, you need to have gdal installed in order to use it. if you are using arcgis pro python environment it would be there by default.

Same answer as this thread https://community.esri.com/message/910826-re-oserror-cannot-identify-image-file?commentID=910826#com... 

0 Kudos