I'm trying to get code from this repo running, which means I have to make this get_data
function work:
def get_data(self, pickle_path, aug_flag=True):
with open(pickle_path + self.image_filename, 'rb') as f:
images = pickle.load(f) # <--------- THIS line is the problem
images = np.array(images)
print('images: ', images.shape)
# do more things here
But it gives me the error ValueError: unsupported pickle protocol: 3
so I found advice here, where they recommend a different protocol: pickle.dump(images, f, protocol=2)
def get_data(self, pickle_path, aug_flag=True):
with open(pickle_path + self.image_filename, 'rb') as f:
pickle.dump(images, f, protocol=2) # still bad
images = np.array(images)
print('images: ', images.shape)
# do more things here
However, that gives me the error UnboundLocalError: local variable 'images' referenced before assignment
. Is there a way I can fix this, specifically for StackGAN/misc/datasets.py
?