I am trying to make the below code work since morning. I have read tutorials on google about python, I have done 0 progress. Can you help me with this error:
Another question: Can I transform the folder with the images to a pickle (.P) file?
Using TensorFlow backend.
Traceback (most recent call last):
File "source_code_modified.py", line 65, in <module>
dict1 = pickle.load(f1,encoding='bytes')
TypeError: file must have 'read' and 'readline' attributesThe code that explodes is this part:class load_train_data:
os.open("/home/mojito/Desktop/CNN/datasets/training_data/images", os.O_RDONLY)
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
pass
class load_test_data:
os.open("/home/mojito/Desktop/CNN/datasets/test_data/images",os.O_RDONLY)
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
pass
with load_train_data() as f1:
dict1 = pickle.load(f1,encoding='bytes')I tried to fix this with the code below and I got a new error:Using TensorFlow backend.
Traceback (most recent call last):
File "source_code_modified.py", line 74, in <module>
with open_train_data() as f1:
File "source_code_modified.py", line 47, in open_train_data
return open('/home/mojito/Desktop/CNN/datasets/training_data/images','rb')
IsADirectoryError: [Errno 21] Is a directory: '/home/mojito/Desktop/CNN/datasets/training_data/images'the code explodes in this part:def open_train_data():
return open('/home/mojito/Desktop/CNN/datasets/training_data/images','rb') <--- explodes here
def open_test_data():
return open('/home/mojito/Desktop/CNN/datasets/test_data/images','rb')
with open_train_data() as f1:
dict1 = pickle.load(f1) <--- explodes hereWhat I am trying to do is to load a custom dataset of images for a CNN stored to my PC in the format (trainX, trainY), (testX, testY) = ...Another question: Can I transform the folder with the images to a pickle (.P) file?
