André Cruz
2016-04-05 14:54:36 UTC
Hello all.
I've been using GraphLab while doing a machine learning specialization in Coursera (https://www.coursera.org/specializations/machine-learning). However, I would also like to try scikit-learn for comparison and maybe use it since it is open source. Could someone look at this GraphLab snippet and help me convert it to scikit-learn? Basically I'm loading the AlexNet model pre-trained on the imagenet dataset, extracting features from images stored locally, and then using k-nearest neighbour to find similar images based on some queries:
-------------
import graphlab
# build model
image_data = graphlab.image_analysis.load_images('images/') # load images from dir
deep_learning_model = graphlab.load_model('http://s3.amazonaws.com/GraphLab-Datasets/deeplearning/imagenet_model_iter45') # load trained imagenet model
image_data['deep_features'] = deep_learning_model.extract_features(image_data)
knn_model = graphlab.nearest_neighbors.create(image_data,features=['deep_features'])
# query model
query_sframe = graphlab.image_analysis.load_images('query')
query_sframe['deep_features'] = deep_learning_model.extract_features(query_sframe)
results = knn_model.query(query_frame)
-------------
Thanks for the help and best regards,
André Cruz
------------------------------------------------------------------------------
I've been using GraphLab while doing a machine learning specialization in Coursera (https://www.coursera.org/specializations/machine-learning). However, I would also like to try scikit-learn for comparison and maybe use it since it is open source. Could someone look at this GraphLab snippet and help me convert it to scikit-learn? Basically I'm loading the AlexNet model pre-trained on the imagenet dataset, extracting features from images stored locally, and then using k-nearest neighbour to find similar images based on some queries:
-------------
import graphlab
# build model
image_data = graphlab.image_analysis.load_images('images/') # load images from dir
deep_learning_model = graphlab.load_model('http://s3.amazonaws.com/GraphLab-Datasets/deeplearning/imagenet_model_iter45') # load trained imagenet model
image_data['deep_features'] = deep_learning_model.extract_features(image_data)
knn_model = graphlab.nearest_neighbors.create(image_data,features=['deep_features'])
# query model
query_sframe = graphlab.image_analysis.load_images('query')
query_sframe['deep_features'] = deep_learning_model.extract_features(query_sframe)
results = knn_model.query(query_frame)
-------------
Thanks for the help and best regards,
André Cruz
------------------------------------------------------------------------------