ExportTrainingTool error resnet_family not defined

2778
9
11-19-2020 02:00 PM
JuliaSurkis1
New Contributor II

I am trying to create a script (relatively new to python) to automate running ExportTrainingTool, but I keep getting an error. I have all the necessary packages installed as far as I can tell and I'm in my "deeplearning" environment where I added the packages. The error I'm assuming has to do with the backbone model parameter and the error I get is: 

NameError: name '_resnet_family' is not defined

I have image analyst, and I have previously run this as a gp tool in ArcPro successfully (a few months ago so something could have changed).

My parameters are: 

 

 

 

in_folder = "C:/Users/18602/Documents/Masters Program/final_project/Geog6180_FinalProject/LabeledObjects"
out_folder = "C:/Users/18602/Documents/Masters Program/final_project/Geog6180_FinalProject"
max_epochs = 25 #A maximum epoch of one means the dataset will be passed forward and backward through the neural network one time.
model_type = "SSD" #Single Shot Detection - object detection. This is the method of the model, and was chosen as it is the example method for well pad selection
batch_size = 2
arg = "grids '[4, 2, 1]';zooms '[0.7, 1.0, 1.3]';ratios '[[1, 1], [1, 0.5], [0.5, 1]]'" #default grid zoom and ratio values
#learning_rate = 0.003
backbone_model = "RESNET34"
#pretrained_model =
validation_percent = 10 #default
stop_training = "STOP_TRAINING"
freeze = "FREEZE_MODEL"

# Execute
TrainDeepLearningModel(in_folder, out_folder, max_epochs, model_type,
                       batch_size, arg, None, backbone_model,None,
                       validation_percent, stop_training, freeze)

 

 

 

0 Kudos
9 Replies
DanPatterson
MVP Esteemed Contributor
arcpy.CheckOutExtension("ImageAnalyst")

seems to be missing from your example

See the code examples in

train-deep-learning-model 


... sort of retired...
0 Kudos
JuliaSurkis1
New Contributor II

Thanks, but I forgot to include the first part of my code which is this: 

 

# Import system modules  
import arcpy
from arcpy.ia import *


# Check out the ArcGIS Image Analyst extension license 
arcpy.CheckOutExtension("ImageAnalyst")

 

I had assumed the problem was in the part I originally posted, but it's probably important to include everything

 

0 Kudos
StewartWareing
New Contributor

I have a similar problem in Pro. 

Although I have a cloned environment with the "deep learning" modules, for some reason it keeps switching to base environment, which in turn brings up the _resnet family error.

In the end I ran the script in an IDE with the relevant environment and it worked fine. 

0 Kudos
7177
by
New Contributor II

I'm unsuccesfully trying to train a Feature Classifier and have been  plagued by the same type of error message on ArcGIS Pro 2.7, regardless of training data and format. The Train Deep Learning Tool refuses to execute complaining a parameter is missing. Hovering over the error indicator appearing next to the Input Training Data field yields the following error: 

ERROR 032659 updateParameters Error: Traceback (most recent call last):
File "c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Image Analyst Tools.tbx\TrainDeepLearningModel.tool\tool.script.validate.py", line 261, in <module>
File "c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Image Analyst Tools.tbx\TrainDeepLearningModel.tool\tool.script.validate.py", line 117, in updateParameters
backbone_list = training_model._supported_backbones()
File "C:\Users\p.funovits\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone3\lib\site-packages\arcgis\learn\models\_classifier.py", line 179, in _supported_backbones
return [*_resnet_family, models.mobilenet_v2.__name__]
NameError: name '_resnet_family' is not defined

 

Is there any remedy or workaround for this? 

0 Kudos
desalas
New Contributor II

Desperately need a solution to this same problem. Please advise if anyone found a solution. 

JasperWong
New Contributor

you'll need to change your python environment to the one where your deep learning packages are installed. restart arcgis pro, and then try again. 

0 Kudos
wondimagegnabebe
New Contributor

HEllo Every one 

Recently I have face with the following problem 

error 032659 updateparameters error: traceback (most recent call last): file c:\program files\arcgis...

I have no idea how to fix it please help

0 Kudos
PeterGeorge_GEOJobe
New Contributor II

I'm having the same issue in the Geoprocessing tool Train Deep Learning Model when inputting my chips. My licenses are correct. Followed the Geospatial Deep Learning Video here 13 minutes in. 
Gives me Error 032659, which is a broken link. The details involve NameError : name '_resnet_family' is not defined

0 Kudos
lihongzhu
New Contributor

That means that you have not successfully installed the deep learning framework,the "_resnet_family= [models.resnet18.__name__, models.resnet34.__name__, models.resnet50.__name__,models.resnet101.__name__, models.resnet152.__name__]" ,you can try to input this code in python window:“from torchvision import models”,maybe you will get "ModuleNotFoundError: No module named 'torchvision'",so you should reinstall deep learning framwork for ArcGIS Pro.

0 Kudos