0

I got this error:

UnboundLocalError: local variable 'y_max' referenced before assignment


UnboundLocalError Traceback (most recent call last)

<ipython-input-4-c01841a65106> in <module>
      1 #assign "-"=10
----> 2 data=load_images_from_folder("D:/Handwritten-Equation-Solver-master (1)/Handwritten-Equation-Solver-master/extracted_images/-")
      3 len(data)
      4 for i in range(0,len(data)):
      5     data[i]=np.append(data[i],["10"])

<ipython-input-2-16a05bc6df7c> in load_images_from_folder(folder)
     19                     h_max=h
     20                     w_max=w
---> 21             im_crop=thresh[y_max:y_max+h_max+10,x_max:x_max+w_max+10]
     22             im_resize=cv2.resize(im_crop,(28,28))
     23             im_resize=np.reshape(im_resize,(784,1))
molbdnilo
  • 64,751
  • 3
  • 43
  • 82
Santhosh
  • 38
  • 1
  • 8
  • 1
    Please post your code too. – Ram Jun 13 '21 at 07:49
  • This error usually occurs when you try to access a variable that's yet to be assigned, but exists somewhere in the program, [this](https://stackoverflow.com/a/9264845/14033284) is a reference that you'd find useful – Novus Edge Jun 13 '21 at 07:51

0 Answers0