You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have repeatedly run across an issue of the preprocessing step failing partway through. As far as I can tell, this is due to a Windows-created desktop.ini file being flagged as 'ignored' but failing to actually be ignored:
File ./Photos\desktop.ini was ignored
File "C:\Users\\ML-Morph\ml-morph-v.1.0.0\preprocessing.py", line 17, in
file_sizes=utils.split_train_test(args['input_dir'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\ML-Morph\ml-morph-v.1.0.0\utils.py", line 245, in split_train_test
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`
File "C:\Users\*\ML-Morph\ml-morph-v.1.0.0\utils.py", line 267, in image_prep
return file_sz
^^^^^^^
UnboundLocalError: cannot access local variable 'file_sz' where it is not associated with a value
The return statement fails due to 'file_sz' not existing.
The following slight modification appears to fix the issue and allow the extraneous file to actually get ignored:
(This is within utils.py)
def image_prep(file, name, dir_path):
Internal function used by the split_train_test function. Reads the original image files and, while
converting them to jpg, gathers information on the original image dimensions.
Parameters:
file(str)=original path to the image file
name(str)=basename of the original image file
dir_path(str)= directory where the image file should be saved to
Returns:
file_sz(array): original image dimensions
img = cv2.imread(file)
if img is None:
print('File {} was ignored'.format(file))
****file_sz = [0, 0] #give the return statement something so it won't just fail? GLD****
else:
file_sz= [img.shape[0],img.shape[1]]
cv2.imwrite(os.path.join(dir_path,name), img)
return file_sz
The text was updated successfully, but these errors were encountered:
I have repeatedly run across an issue of the preprocessing step failing partway through. As far as I can tell, this is due to a Windows-created desktop.ini file being flagged as 'ignored' but failing to actually be ignored:
The return statement fails due to 'file_sz' not existing.
The following slight modification appears to fix the issue and allow the extraneous file to actually get ignored:
(This is within utils.py)
def image_prep(file, name, dir_path):
The text was updated successfully, but these errors were encountered: