"Export training data for deep learning" creates multiband raster

569
2
04-29-2020 01:44 AM
MoritzWollen
New Contributor II

I'm trying to export some RCNN-Mask training data using the "export training data for deep learning" tool in ArcGIS 2.5. I pass a 32 bit floating point singleband raster as input raster and a shape file containing buildings as input feature (+ property of input feature as class value field) to the tool.

The resulting images in the "Image" directory seems to be fine. The "Label" folder, on the other hand, contains weird a mix of singleband- and multiband (2 and 3 bands also) raster files,

e.g. (all files from same "Label"-subdirectory):

  • file 6 is a multiband raster using the bands 1 and 2
  • file 9 is a multiband raster using the bands 1-3
  • file 7 is a singleband raster - each masked feature (buildings with same properties) is mapped to an other value. Shouldn't the result be a true-false masking raster containing the values 0 or 1?

My workaround so far is a python script, iterating all bands of a given file, checking if a cell is occupied using map algebra. If that cell is occupied the new value is 1.

bands = []
for band in range(int(arcpy.GetRasterProperties_management(img, 'BANDCOUNT').getOutput(0))):
    bands.append(arcpy.sa.Raster(os.path.join(path, img.name, 'Band_{}'.format(band+1))))
res = bands[0]
for i in range(1, len(bands)):
    res = res + bands[i]
res = res > 0

At this point i have singleband raster files only. Before training a model with the ArcGIS "train deep learning model" tool i have to copy the statistical files generated by the "generate training data for deep learning" tool into the directory of my updated raster files.

If i try to use my trained model using the "detect objects using deep learning" tool i get the error:

Why is the result of "creating training data for deep learning" a mixture of single- and multiband rasters, although only singleband rasters were given?

Shouldn't the singleband results be true-false masking rasters containing the values 0 or 1?

Is there a wrong approach in my workaround?

2 Replies
LorenaAbad
New Contributor

Hello! Did you ever find a solution to this issue? I am having the same problem.

0 Kudos
ÁkosHalmai
Occasional Contributor II

Same issue here, at 2.7.1. The labels are mixture of 1 and 2-band-rasters.

0 Kudos