Select to view content in your preferred language

Automating Classify Objects Using Deep Learning Error

827
3
09-11-2023 02:58 PM
Labels (1)
DerickTrinidad
New Contributor II

I am trying to create a python script to automate the "Detect Objects Using Deep Learning" tool box. I have deduced that my error comes from running the following python command:
with arcpy.EnvManager(processorType="GPU"):
out_classified_raster = arcpy.ia.DetectObjectsUsingDeepLearning(
in_raster="tw-a_resized.png",
out_detected_objects=save_output_raster_path,
in_model_definition = pre_trained_model,
arguments="padding 56;batch_size 4;threshold 0.9;return_bboxes False;test_time_augmentation False;merge_policy mean;tile_size 224",
run_nms="NO_NMS",
confidence_score_field="Confidence",
class_value_field="Class",
max_overlap_ratio=0,
processing_mode="PROCESS_AS_MOSAICKED_IMAGE"
)
out_classified_raster.save(None)
(I just copied the python command from the geoprocessing window.)
DetectObjectsUsingDeepLearning tool worked, it was able to classify my raster no issues
but at the end of the code I get the following error:
AttributeError: 'ArcGISInstanceDetector' object has no attribute 'updatePixels'
Failed to execute (Tool).

I do not have 'ArcGISInstanceDetector' or 'updatePixels' in my script and this error must be related when executing 'DetectObjectsUsingDeepLearning '. Is there a way to patch and fix this bug so my script doesn't error out when I Detect objects? Alternatively, is there a way to force my python script to succeed if it classifies the raster with no issues?
Error Snap Shot:
Screenshot 2023-09-11 174750.png

Classified Raster Snapshot:

DetectObjectsUsingDeepLearning is working as intended but I am still getting this unknown error...

class.png

0 Kudos
3 Replies
PavanYadav
Esri Contributor

Hi @DerickTrinidad 

ArcGISInstanceDetector should be at your C:\Program Files\ArcGIS\Pro\Resources\Raster\Functions\System\DeepLearning\ArcGISLearn folder it is installed by ArcGIS Pro installer. 

Looks like you're using an MaskRCNN model that's why the tool is trying to use ArcGISInstanceDetector. 

Can you confirm the same model works with the Detect Objects Using Deep Learning tool? if yes, can you share your script? If the tool works, the script should also work. Did you train the model in ArcGIS Pro?

 

Note: We have an imagery dedicated community - https://community.esri.com/t5/arcgis-image-analyst/ct-p/arcgis-image-analyst and here you might get response sooner.

 

Cheers!

Pavan Yadav | Product Engineer 
Esri | 380 New York | Redlands, 92373 | USA

https://www.linkedin.com/in/pavan-yadav-1846606/ 

Pavan Yadav
Product Engineer at Esri
AI for Imagery
Connect with me on LinkedIn!
Contact Esri Support Services
0 Kudos
p-vdp
by
New Contributor

I'm also experiencing this issue when running arcpy.ia.DetectObjectsUsingDeepLearning in a Python toolbox:

AttributeError: 'ArcGISObjectDetector' object has no attribute 'updatePixels'

However inference seems to be working OK. My model uses YOLO trained and run entirely within ArcGIS Pro 3.1.3.

I think this is a bug.

I was able to suppress the error by editing C:\Program Files\ArcGIS\Pro\Resources\Raster\Functions\System\DeepLearning\ArcGISLearn\ArcGISObjectDetector.py and adding this method to the ArcGISObjectDetector class:

def updatePixels():
        pass

 

0 Kudos
PavanYadav
Esri Contributor

@p-vdp you might be right about this problem being a bug. Is it possible for your to share your test data with me (if so, please email me at - pyadav AT esri.com)? Or you can contact Esri Support Services. I will also try to test it with my data at my end to see if I can reproduce. thanks

 

Pavan Yadav
Product Engineer at Esri
AI for Imagery
Connect with me on LinkedIn!
Contact Esri Support Services
0 Kudos