AnsweredAssumed Answered

UnboundLocalError when calling 'Classified_Tiles' in prepare_data

Question asked by smescarzaga on Jan 22, 2020
Latest reply on Feb 12, 2020 by smescarzaga

I've exported Classfied_Tile formatted image chips from ArcGIS Pro to train a Unet Classifier. However, when setting up 'prepare_data' function I get an UnboundLocalError. I'm running this in Jupyter Lab

 

Input:

data = prepare_data(data_path, {1:'Ocean', 2:'Sand', 3:'Mud', 4:'Pond', 5:'Red Pond', 6:'Foam', 7:'Tundra', 8:'Bare', 9:'Mud' }, batch_size=16, dataset_type = 'Classified_Tiles') 

 

Output:

---------------------------------------------------------------------------UnboundLocalError                         Traceback (most recent call last)<ipython-input-9-ab7c0384d6f5> in <module>()      5 # however, this notebook leaves out the fact that you need to directly infer that to the script with 'dataset_type'      6 ----> 7 data = prepare_data(data_path, {1:'Ocean', 2:'Sand', 3:'Mud', 4:'Pond', 5:'Red Pond', 6:'Foam', 7:'Tundra', 8:'Bare', 9:'Mud' }, batch_size=16, dataset_type = 'Classified_Tiles')~\AppData\Local\ESRI\conda\envs\palm-detection\lib\site-packages\arcgis\learn\_data.py in prepare_data(path, class_mapping, chip_size, val_split_pct, batch_size, transforms, collate_fn, seed, dataset_type, resize_to, **kwargs)    463     elif dataset_type == 'Classified_Tiles':    464 --> 465         def get_y_func(x, ext=right):    466             return x.parents[1] / 'labels' / (x.stem + '.{}'.format(ext))    467  UnboundLocalError: local variable 'right' referenced before assignment

 

I should mention, I don't get this error when using PASCAL rectangles for SSO training. Looks like it has something to do with classified tiles format.

 

Can someone help me get around this?

Thanks.

Outcomes