I have several images in a folder and i am trying to turn each one into grayscale and save them into another folder
Google Colab session keeps crashing due to running out of ram and i have tried using del on every variable
here is my code
img_array = []
for filename in FileArray:
img = cv2.imread('train/train/Img-'+filename)
height, width, layers = img.shape
size = (width, height)
img_array.append(img)
image = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.imwrite('train/gray/Img-'+filename, image)
del img
del height
del width
del layers …
Run Code Online (Sandbox Code Playgroud)