Error when training deep learning model

1680
4
Jump to solution
08-19-2022 07:39 AM
Labels (3)
SteveCacioppo
New Contributor II

I'm trying to train my model and am getting the following error:

Start Time: Friday, August 19, 2022 8:59:06 AM
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 1822, in prepare_data
    ArcGISInstanceSegmentationItemList.from_folder(path / "images")
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\fastai\data_block.py", line 479, in _inner
    self.train = ft(*args, from_item_lists=True, **kwargs)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\fastai\data_block.py", line 303, in label_from_func
    return self._label_from_list([func(o) for o in self.items], label_cls=label_cls, **kwargs)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\fastai\data_block.py", line 279, in _label_from_list
    y = label_cls(labels, path=self.path, **kwargs)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\learn\models\_maskrcnn_utils.py", line 97, in __init__
    if is_no_color(list(color_mapping.values())):
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\learn\models\_maskrcnn_utils.py", line 70, in is_no_color
    return (np.array(color_mapping) == [-1.0, -1.0, -1.0]).any()
AttributeError: 'bool' object has no attribute 'any'

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).
Failed at Friday, August 19, 2022 8:59:11 AM (Elapsed Time: 4.73 seconds)

 

I think this is what's causing the model to fail, but I'm not sure how to rectify this issue.

AttributeError: 'bool' object has no attribute 'any'

 

Here are the parameters I am using to train the model on a sample area:

SteveCacioppo_0-1660919707079.png

SteveCacioppo_1-1660919778764.png

I've been messing around with this for over a week and I'm stuck.  Any suggestions?

0 Kudos
1 Solution

Accepted Solutions
SteveCacioppo
New Contributor II

I finally figured this one out.  First of all, when using the MaskRCNN model for object detection, the class values for the input training data must start at 1 (I was using 0).  Secondly, you need to have at least two class values in order to train the deep learning model when using the MaskRCNN.  Here are the inputs I used that worked:

SteveCacioppo_0-1661521564562.pngSteveCacioppo_1-1661521590642.pngSteveCacioppo_2-1661521610238.png

 

View solution in original post

4 Replies
SteveCacioppo
New Contributor II

I finally figured this one out.  First of all, when using the MaskRCNN model for object detection, the class values for the input training data must start at 1 (I was using 0).  Secondly, you need to have at least two class values in order to train the deep learning model when using the MaskRCNN.  Here are the inputs I used that worked:

SteveCacioppo_0-1661521564562.pngSteveCacioppo_1-1661521590642.pngSteveCacioppo_2-1661521610238.png

 

AlexaVerónicaGarcíaBarrantes
New Contributor II

Hi Steve 

I'm using PASCAL instead of Mask, do you know if I still need to have two class values?

0 Kudos
byrondelgado
New Contributor

Hi Steve, 

I read and followed your instructions but still no luck. Please, can you be more specific with the values recommendations for the values assigned to the samples?  Here attached are the messages I get when trying to train the model. 

Thank you and regards...

0 Kudos
PavanYadav
Esri Contributor

@byrondelgado Hi, have you been able to get it work. From the attached error, it looks like there was an internet issue. thanks in advance for any details you may share. 

thanks

Pavan

0 Kudos