Select to view content in your preferred language

Using the Label Objects for Deep Learning to export tiles for import via tensorflow.keras

2284
4
05-13-2021 09:55 AM
Manu
by
Regular Contributor

I exported tiles from a GeoTIFF for import and use with tensorflow outside ArcGIS Pro using the "Label Objects for Machine Learning" tool in ArcGIS Pro.
However, the file structure is different from what tf.keras.preprocessing.image_dataset_from_directory(...) expects and I also think tensorflow will not accept .tif by default. Anyone who has experience using the ArcGIS Pro "Label Objects for Machine Learning" tool in combination with subsequent import in a python session?

0 Kudos
4 Replies
Tim_McGinnes
Frequent Contributor

The TIF issue is easy to fix - just choose a different format when you export - PNG probably the best.

Import to Tensorflow\Keras generally requires some Python code to convert the images & labels into the internal data structure. It depends on what you are trying to do in Keras as to which export format would be best to use. What type of task are you doing: image classification, object detection, pixel classification? What model are you going to use in Keras: SingleShotDetector, FasterRCNN, MaskRCNN, Unet, etc.?

There will generally be some code out there that you can take and adapt to your data.

0 Kudos
Manu
by
Regular Contributor

Thanks for your answer, I am planning to use a U-Net for image segmentation and classification. I just noticed the different export options (Meta Data Format) in ArcGIS Pro that produce various data structures; I've tried a few but I have not yet gotten a similar structure from what I've seen in example CNN training on the web...

0 Kudos
Tim_McGinnes
Frequent Contributor

U-Net is not something I have a lot of experience in unfortunately. I have found a couple of pages with both code and data which may help.

This project does image classification on satellite imagery and seems quite straightforward - it has 2 input folders with TIF files that should correspond to the Classified Tiles metadata format output from ArcGIS.

https://github.com/reachsumit/deep-unet-for-satellite-image-segmentation 

This project has a good blog post with lots of  background and github site with the code in a notebook. Same structure of 2 folders with images\masks, but not sure of file format.

Blog: https://towardsdatascience.com/understanding-semantic-segmentation-with-unet-6be4f42d4b47 

Github: https://github.com/hlamba28/UNET-TGS 

Sorry I couldn't be of more help - but hopefully they may assist, or at least point you in the right detection.

DrVSSKiran
Frequent Contributor

Hi Manu,

Tensorflow supports Tif and GeoTif in both formats.  Unet is good for land cover classification and Mark rcnn is good to got detecting building. If it's a single object you can try SSD as well.

Getting the error in Labeling the objects, exporting the chips, and detecting objects are mainly depending on python libraries. Please check the libraries and it's the version which you installed. If the version is not matches to the available one try to downgrade or upgrade to the relevant version and try it.

Here is few tips, if you wish to run outside of ArcGIS Pro:

  1.         Download and install the minconda
  2.         Create new env ‘conda create -n arcgis -c esri arcgis_learn python=3.7.’
  3.         Activate the arcgis by using ‘conda activate arcgis’
  4.        Optional: if require pip install the relevant libraries

Once your env is get activated you can start to train the model.

 

Thanks

 

0 Kudos