Use [py]caffe models in scikit-learn

21 views
Skip to first unread message

mau

unread,
May 26, 2017, 4:25:38 AM5/26/17
to Caffe Users
Is there a way to use a caffe model (eventually in python) in scikit-learn code?

My purpose is to use scikit model selection (random search) with my network defined in caffe

Thanks!

Jonathan R. Williford

unread,
May 26, 2017, 4:53:32 AM5/26/17
to mau, Caffe Users
This should be relatively straightforward with using PyCaffe (at least in theory). Have you tried loading your model with PyCaffe? Eventually, you will need to use Python to create the model, instead of the prototxt, but loading an existing model would be a good starting point.

Good luck!
Jonathan

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users+unsubscribe@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/bb9f9e61-e00c-4293-a429-78b8aa8cc255%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mau

unread,
May 26, 2017, 5:10:53 AM5/26/17
to Caffe Users
Thank you for your reply, Jonathan! 

Yes, i agree with you, i've my model in prototxt and in python code (which it's created and started in runtime).
But scikit methods, like random search or grid search, accept at first argument an estimator "implemented in scikit-learn estimator interface".

Probably i could use other libraries that implement random search simply taking loss error, but i don't know if it exist! :)

Jonathan R. Williford

unread,
May 26, 2017, 5:52:49 AM5/26/17
to mau, Caffe Users
Have you seen this:

It looks like it might be helpful. Also:

Perhaps you only need to create a wrapper than return Score, and set this to be the inverse of loss?

Cheers,
Jonathan

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users+unsubscribe@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.

mau

unread,
May 26, 2017, 6:06:01 AM5/26/17
to Caffe Users
Yes, i see it just now! 

I believe that i would instantiate all methods by inheritance. 

i'm watching this interesting video from EuroPython 2014 that explain how to extend scikit with own regressor:

Cheers,
Maurizio
Reply all
Reply to author
Forward
0 new messages