Multithreading/Multicore processing mean shift segmention fails

509
2
12-29-2021 09:29 AM
Labels (2)
FelixKroeber
New Contributor

Hey everybody,

I'm trying to use the mean shift segmentation to segment a high-resolution rgb 8-bit image (ArcGISPro 2.9). When specifying the parallel processing factor with 0 (=do not spread operations across multiple processes), the algortihm works fine. Nevertheless, tyring to utilise the power of multiple threads regulary fails. The error message (which is not alwalys the same) relates to sth. regarding max_segment_size (see below). Any ideas on this?

#1 - does not work
with arcpy.EnvManager(outputCoordinateSystem='PROJCS["WGS_1984_UTM_Zone_32N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]', parallelProcessingFactor="80%", extent="400000 5320000 410000 5330000"):
out_raster_dataset = arcpy.ia.SegmentMeanShift(r"C:\Users\felix\OneDrive\Studium_Master\semester_I_Spatial_Analyses\assignment_solar\solar_analyses\high_res_rgb.tif", 15, 2, -1, '', -1); out_raster_dataset.save(r"C:\Users\felix\OneDrive\Studium_Master\semester_I_Spatial_Analyses\assignment_solar\solar_analyses\solar_analyses.gdb\field_segmentation")
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\ia\Functions.py", line 3792, in SegmentMeanShift
max_segment_size)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sa\Utils.py", line 55, in swapper
result = wrapper(*args, **kwargs)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\ia\Functions.py", line 3784, in Wrapper
max_segment_size)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
The connection to the local worker service has been lost.
The connection to the local worker service has been lost.
The connection to the local worker service has been lost.
The connection to the local worker service has been lost.
The connection to the local worker service has been lost.
The connection to the local worker service has been lost.
Failed to execute (SegmentMeanShift).#

 

#2 - works

with arcpy.EnvManager(outputCoordinateSystem='PROJCS["WGS_1984_UTM_Zone_32N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]', parallelProcessingFactor="2", extent="400000 5320000 402000 5323000"):
out_raster_dataset = arcpy.ia.SegmentMeanShift(r"C:\Users\felix\OneDrive\Studium_Master\semester_I_Spatial_Analyses\assignment_solar\solar_analyses\high_res_rgb.tif", 15, 2, -1, '', -1); out_raster_dataset.save(r"C:\Users\felix\OneDrive\Studium_Master\semester_I_Spatial_Analyses\assignment_solar\solar_analyses\solar_analyses.gdb\field_segmentation")

 

#3 - does not work
with arcpy.EnvManager(outputCoordinateSystem='PROJCS["WGS_1984_UTM_Zone_32N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]', parallelProcessingFactor="8", extent="400000 5320000 402000 5323000"):
out_raster_dataset = arcpy.ia.SegmentMeanShift(r"C:\Users\felix\OneDrive\Studium_Master\semester_I_Spatial_Analyses\assignment_solar\solar_analyses\high_res_rgb.tif", 5, 2, -1, '', -1); out_raster_dataset.save(r"C:\Users\felix\OneDrive\Studium_Master\semester_I_Spatial_Analyses\assignment_solar\solar_analyses\solar_analyses.gdb\field_segmentation")
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\ia\Functions.py", line 3792, in SegmentMeanShift
max_segment_size)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sa\Utils.py", line 55, in swapper
result = wrapper(*args, **kwargs)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\ia\Functions.py", line 3784, in Wrapper
max_segment_size)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to execute (SegmentMeanShift).

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

a noted bug BUG-000117447: Running the Segment Mean Shift tool from the Spatial.. (esri.com)

was deemed to be fixed in Pro 2.4

Parallel Processing Factor (Environment setting)—ArcGIS Pro | Documentation

it seems that when you set your factor > 50% (2) it fails.  You will have to see if anything in the above link applies to you setup


... sort of retired...
0 Kudos
FelixKroeber
New Contributor

Thanks for replying but the already fixed bug is most probably not related to my case since performing segmentation without multicores works fine.

 

0 Kudos