ml4a / ml4a

A python library and collection of notebooks for making art with machine learning.

Home Page:https://ml4a.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no package with import cPickle as pickle

daviddou82 opened this issue · comments

The package name for cPickle must be changed to _pickle for the import statements to work.

import cPickle as pickle

import _pickle as cPickle

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.

okay. Thanks.

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]))