Select to view content in your preferred language

Train Deep learning Model.

5850
12
Jump to solution
09-16-2022 03:51 AM
Labels (2)
epiewesner
Emerging Contributor

Greetings. I am trying to train my data using the deep learning model, but i keep getting this error message. Can someone help me out.

Traceback (most recent call last):
File "c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Image Analyst Tools.tbx\TrainDeepLearningModel.tool\tool.script.execute.py", line 308, in execute
data_bunch = prepare_data(in_folders, working_dir=out_folder, **prepare_data_kwargs)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\learn\_data.py", line 1440, in prepare_data
raise Exception(
Exception: Could not infer dataset type. Please specify a supported dataset type or ensure that the path contains valid esri files

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Image Analyst Tools.tbx\TrainDeepLearningModel.tool\tool.script.execute.py", line 390, in <module>
execute()
File "c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Image Analyst Tools.tbx\TrainDeepLearningModel.tool\tool.script.execute.py", line 384, in execute
del data_bunch
UnboundLocalError: local variable 'data_bunch' referenced before assignment

Failed script (null)...
Failed to execute (TrainDeepLearningModel).

0 Kudos
12 Replies
PawanThapa2
Emerging Contributor

I have a small area, so I change image chip 128 instead of 512 to extract training sample, it works.

If I use 512, then I get only three samples so I decrease it to 128

Also, I faced other error: Error:Error(s) in loading state_dict for _DeepLabOverride: size mismatch for backbone.conv1.weight: copying a param with shape torch.Size([64, 3, 7, 7]) from checkpoint, the shape in current model is torch.Size([64, 4, 7, 7])..Training was not sucessful

then use extract band make three bands, it solved

 

I have 7 samples and I use 0.5 in the % validation parameter, to make whole number. Still I got the Error:division by zero.Training was not successful.

PawanThapa2_1-1718647100340.png

 

PawanThapa2_0-1718646999898.png

 

0 Kudos
PavanYadav
Esri Regular Contributor

@KevinRathgeber1 glad you have fixed the problem. Was it for a test? Because 4 samples are very little. 

I often hear that we need at least 1000 samples for each category; but it really depends on many things for example some architectures needs no or very minimum labels. DetReg supported in ArcGIS is one example that needs much less labels comparing to other model architectures. You might find these interesting: https://sites.uab.edu/periop-datascience/2021/06/28/sample-size-in-machine-learning-and-artificial-i...  , https://machinelearningmastery.com/much-training-data-required-machine-learning/ and https://towardsdatascience.com/how-do-you-know-you-have-enough-training-data-ad9b1fd679ee

If you want to try out an end-to-end deep learning workflow in ArcGIS, these are good tutorials: 
https://learn.arcgis.com/en/projects/use-deep-learning-to-assess-palm-tree-health/ 
https://learn.arcgis.com/en/projects/automate-fire-damage-assessment-with-deep-learning/ 

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

Yeah I was just playing around with the concept of it trying to get it working.  And from the results I got I could tell it was very little lol.  Thanks for your help.