no package with import cPickle as pickle
daviddou82 opened this issue · comments
daviddou82 commented
The package name for cPickle must be changed to _pickle for the import statements to work.
import cPickle as pickle
import _pickle as cPickle
Gene Kogan commented
this is just a python / python3 difference. if you're using python3, you just need to do "import pickle". i'll fix this in an update of the notebooks soon.
daviddou82 commented
okay. Thanks.
gu-ma commented
For python3 the pickle object needs to be loaded with 'rb'
images, pca_features = pickle.load(open('../data/features_caltech101.p', 'rb'))
then to iterate through the results:
for i, f in list(zip(images, pca_features))[:5]:
print("image: %s, features: %0.2f,%0.2f,%0.2f,%0.2f... "%(i, f[0], f[1], f[2], f[3]))