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).
Solved! Go to Solution.
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.
@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/
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.