Good day, friends.
I'm trying to load my own file to Google Colab from my own disc, and I use the code with image.load_img. But programm thinks that there is no such a file. I see this file and not agree with Google. )
Could you please make an advice how can I make code to work correctly. Please tell me if I made any mistake. And what is the right way to type path when file is on PC and file is in Colab folder
Thank you very much.
Code is:
from tensorflow.keras import utils
from tensorflow.keras.preprocessing import image
import numpy as np
import pandas as pd
import pylab
from google.colab import files
from PIL import Image
path = 'C:\XYZ\pic7.jpg'
x = image.load_img(path, target_size = (800, 600), color_mode = 'grayscale')
Colab says:
...
FileNotFoundError Traceback (most recent call last)
<ipython-input-43-a3755b9d97b5> in <module>()
9 path = 'C:\XYZ\pic7.jpg'
10
---> 11 x = image.load_img(path, target_size = (800, 600), color_mode = 'grayscale')
1 frames
/usr/local/lib/python3.7/dist-packages/keras_preprocessing/image/utils.py in load_img(path, grayscale, color_mode, target_size, interpolation)
111 raise ImportError('Could not import PIL.Image. '
112 'The use of `load_img` requires PIL.')
--> 113 with open(path, 'rb') as f:
114 img = pil_image.open(io.BytesIO(f.read()))
115 if color_mode == 'grayscale':
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\XYZ\\pic7.jpg'