I'm a complete newbie to Tensorflow and colab. I am currently working through a beginner tutorial. I am working in colab in google.
I'm trying to run the following code in order to read in a number of image files from my google drive directory containing a number of sub-directories.
def load_data(data_directory):
directories = [d for d in os.listdir(data_directory)
if os.path.isdir(os.path.join(data_directory, d))]
labels = []
images = []
for d in directories:
label_directory = os.path.join(data_directory, d)
file_names = [os.path.join(label_directory, f)
for f in os.listdir(label_directory)
if f.endswith(".ppm")]
for f in file_names:
images.append(skimage.data.imread(f))
labels.append(int(d))
return images, labels
But I get the following error:
NameError: name 'skimage' is not defined
I am not sure if it's because the correct libraries are not loaded. Any assistance would be appreciated.
You should try the following imports (try both just to be sure):
import skimage.io
from skimage import data, io, filters
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.