Discussion:
[Scikit-learn-general] GraphLab to scikit-learn migration help
André Cruz
2016-04-05 14:54:36 UTC
Permalink
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
------------------------------------------------------------------------------
Andreas Mueller
2016-04-05 19:42:28 UTC
Permalink
Hi Andre
There are no pre-trained neural nets (and no convolutional neural nets
at all) in scikit-learn.
Check out sklearn-theano, nolearn or keras.

The knn is pretty straight-forward from the docs.

Cheers,
Andy
Post by André Cruz
Hello all.
-------------
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
------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
------------------------------------------------------------------------------
André Cruz
2016-04-05 20:10:22 UTC
Permalink
Thank you Andy for the pointers. Is any one of those 3 better supported or
recommended in any way for this task? So as to know where to start.

André
Post by Andreas Mueller
Hi Andre
There are no pre-trained neural nets (and no convolutional neural nets
at all) in scikit-learn.
Check out sklearn-theano, nolearn or keras.
The knn is pretty straight-forward from the docs.
Cheers,
Andy
Post by André Cruz
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
Post by André Cruz
-------------
import graphlab
# build model
image_data = graphlab.image_analysis.load_images('images/') # load
images from dir
Post by André Cruz
deep_learning_model = graphlab.load_model('
http://s3.amazonaws.com/GraphLab-Datasets/deeplearning/imagenet_model_iter45')
# load trained imagenet model
Post by André Cruz
image_data['deep_features'] =
deep_learning_model.extract_features(image_data)
Post by André Cruz
knn_model =
graphlab.nearest_neighbors.create(image_data,features=['deep_features'])
Post by André Cruz
# query model
query_sframe = graphlab.image_analysis.load_images('query')
query_sframe['deep_features'] =
deep_learning_model.extract_features(query_sframe)
Post by André Cruz
results = knn_model.query(query_frame)
-------------
Thanks for the help and best regards,
André Cruz
------------------------------------------------------------------------------
Post by André Cruz
_______________________________________________
Scikit-learn-general mailing list
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
Jacob Schreiber
2016-04-05 21:18:33 UTC
Permalink
Hi Andre

I've found keras to be very easy to use, have a lot of features, and has
extensive documentation. However, I usually use mxnet because it seems
faster and allows multi-GPU training very easily.

Jacob
Post by André Cruz
Thank you Andy for the pointers. Is any one of those 3 better supported or
recommended in any way for this task? So as to know where to start.
André
Post by Andreas Mueller
Hi Andre
There are no pre-trained neural nets (and no convolutional neural nets
at all) in scikit-learn.
Check out sklearn-theano, nolearn or keras.
The knn is pretty straight-forward from the docs.
Cheers,
Andy
Post by André Cruz
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
Post by André Cruz
-------------
import graphlab
# build model
image_data = graphlab.image_analysis.load_images('images/') # load
images from dir
Post by André Cruz
deep_learning_model = graphlab.load_model('
http://s3.amazonaws.com/GraphLab-Datasets/deeplearning/imagenet_model_iter45')
# load trained imagenet model
Post by André Cruz
image_data['deep_features'] =
deep_learning_model.extract_features(image_data)
Post by André Cruz
knn_model =
graphlab.nearest_neighbors.create(image_data,features=['deep_features'])
Post by André Cruz
# query model
query_sframe = graphlab.image_analysis.load_images('query')
query_sframe['deep_features'] =
deep_learning_model.extract_features(query_sframe)
Post by André Cruz
results = knn_model.query(query_frame)
-------------
Thanks for the help and best regards,
André Cruz
------------------------------------------------------------------------------
Post by André Cruz
_______________________________________________
Scikit-learn-general mailing list
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
Loading...