In [1]:
import graphlab
In [2]:
image_train_url = 'https://d396qusza40orc.cloudfront.net/phoenixassets/image_train_data.csv'
image_test_url = 'https://d396qusza40orc.cloudfront.net/phoenixassets/image_test_data.csv'
In [3]:
image_train_data = graphlab.SFrame(image_train_url)
image_train_data.head()
Out[3]:
In [4]:
image_test_data = graphlab.SFrame(image_test_url)
image_test_data.head()
Out[4]:
In [5]:
raw_pixel_model = graphlab.logistic_classifier.create(image_train_data, target='label',
features=['image_array'])
In [6]:
# actual image labels (correct answers)
image_test_data[0:5]['label']
Out[6]:
In [7]:
# model output
raw_pixel_model.predict(image_test_data[0:5])
Out[7]:
Raw pixel model only got one out of five predictions correct. That's an F.
In [8]:
raw_pixel_model.evaluate(image_test_data)
Out[8]:
The accuracy of this model is only 47.6%.
In [9]:
# deep_learning_model = graphlab.load_model('http://s3.amazonaws.com/GraphLab-Datasets/deeplearning/imagenet_model_iter45')
# image_train_data['deep_features'] = deep_learning_model.extract_features(image_train_data)
In [10]:
deep_features_model = graphlab.logistic_classifier.create(image_train_data,
features=['deep_features'],
target='label')
In [11]:
# actual image labels (correct answers)
image_test_data[0:5]['label']
Out[11]:
In [12]:
# model output
deep_features_model.predict(image_test_data[0:5])
Out[12]:
It got them all correct! A+.
In [13]:
deep_features_model.evaluate(image_test_data)
Out[13]:
Accuracy is 79%!
In [ ]: