
Caffe2: Open Source Cross-Platform Machine Learning Tools - lacker
http://caffe2.ai/blog/2017/04/18/caffe2-open-source-announcement.html
======
jiayq84
Hey guys - Yangqing here, worked on Caffe and Caffe2 over the years, super
excited to have continuous contribution to the OSS community. I am more than
happy to answer questions if you are curious.

~~~
IshKebab
How difficult is it to set up custom recurrent networks? The only system I've
ever seen that handles this well is CNTK - you can just say `x =
PreviousValue(y)`.

I've tried to work out how to do similar things in Torch and Tensorflow but
all they really offer is pre-packaged layers like LSTM. If you want to make
your own it's difficult, undocumented and not at all ergonomic.

How does Caffe2 compare?

~~~
spangry
I am a complete machine learning noob, so this could just be my lack of skill.
Having looked at most of the popular ML frameworks, none of them seem to
provide an easy, functional way to implement a custom 'neuron'. That is:

    
    
      function (someinput):
          output = do_stuff
          return output
    

Which then gets passed on to the next layer. Again, it's quite possible I've
just missed something, or there is some inherent ML limitation that makes this
impossible. But if such a thing is possible, it would be a rather awesome
feature from my POV.

~~~
Q6T46nT668w6i3m
Many do. For example, the `Lambda` Layer from Keras:

[https://keras.io/layers/core/#lambda](https://keras.io/layers/core/#lambda)

~~~
spangry
Yeah tried that one a while ago but didn't have much success. I'm a bit of a
dummy when it comes to ML. That said, it looks like they've updated the
documentation or something, so might be time to give it another whirl. Thanks
for the reply.

------
lacker
This is the library that powers the "style transfer" feature in Facebook
Messenger: [http://caffe2.ai/docs/AI-Camera-demo-
android.html](http://caffe2.ai/docs/AI-Camera-demo-android.html)

I think Caffe2 is especially suited to machine learning that runs on mobile
devices, so I wouldn't be surprised to see it become more popular as that mode
of machine learning becomes more popular.

~~~
lern_too_spel
What makes Caffe2 especially suited to mobile devices?

~~~
jiayq84
So we carefully made the core much small and also made the platform more
modular, so that the dependencies can be minimal when you build on
Android/iOS. With our build system (buck) we are having very small binary
footprints, which helps delivering the runtime to the phones more easily.

We also did a lot of optimizations on the mobile side - like using NEON,
mobile GPU and stuff for optimized speed.

------
dimatura
Is ARM, and in particular the NVIDIA TK1/TX1/TX2 supported? Ease of use on
these platforms with Theano vs Tensorflow/PyTorch is the main thing keeping me
on Theano.

~~~
jiayq84
Yep, if you look under the scripts/ folder we are putting on example scripts
that you can use to build on specific platforms. Let me know what you think
and feel free to send issues/PRs!

~~~
dimatura
Sweet!

------
polskibus
Does Caffe allow training models on mobile devices or just running already
trained models?

I'm thinking something along the lines of

[https://research.googleblog.com/2017/04/federated-
learning-c...](https://research.googleblog.com/2017/04/federated-learning-
collaborative.html?m=1)

~~~
dzhulgakov
Right now we're training models in server-side environment and run highly
optimized inference on pre-trained model in products (with focus on inference
optimization).

The framework itself allows fine-tuning and training of the model on the
mobile device too, but more work is required to enable particular use cases.

------
hlzz001
A quick question:last year when caffe2 first came out. You suggested to stick
to caffe because caffe2 at that time is not mature. Now that caffe2 is
officially release, is there any reason we should still use caffe?

~~~
jiayq84
There is no push to migrate from Caffe to Caffe2 for sure. After Facebook
"dogfooding" our own implementation, I think it is safe to say that C2 is now
much stable. I would encourage you to try migrating it, letting us know if you
run into problems, and stay tuned for the nice additional features that you
may be able to enjoy from C2 - like optimized computation with MKLDNN, etc.

~~~
hlzz001
Another issue I am concerned about is the visualization tools. As you know,
caffe lags behind tensorflow on the nice visualization tool such as
tensorboard. Would caffe2 have some nice visualization tool like this?

------
mtw
Congrats ! I find the site really well-made and I see a great deal of efforts
were made on making the library usable

Q: I've never used Caffe - based on the examples provided, I would say it's
best for images and videos? I'm interested in NLP (eg seeing patterns in
science papers) or in studying wearables data (gps, heart rate etc.) to
predict user activity.

~~~
jiayq84
Yeah, Caffe2 has the same root as Caffe, so you'll see the image side really
polished - for object recognition, AR, etc.

Over the next weeks/months we'll share more examples on other applications
such as RNNs.

------
nzjrs
Looking forward to the 137 mutually incompatible forks of this. May caffe2
continue in the style of caffe!

~~~
jiayq84
Haha yeah, I definitely feel your pain - as a caffe developer it really makes
me cry when things get so incompatible. I've made some improvements in caffe2
to make it more modular - checkout
[http://GitHub.com/caffe2/caffe2_bhtsne/](http://GitHub.com/caffe2/caffe2_bhtsne/),
things like such will potentially make things more maintainable than the old
Caffe solution.

------
jorgemf
Can someone explain me why they chose Caffe2 as the name? I think this is a
problem for Caffe, as people would see Caffe2 as the newest version of the
library, when they are not related (aren't they?)

I would have preferred them to chose another name.

------
acarabott
Is bringing the OpenCL caffe backend[1] to Caffe2 on the roadmap?

[1]
[https://github.com/BVLC/caffe/tree/opencl](https://github.com/BVLC/caffe/tree/opencl)

------
ceyhunkazel
Great work! Hope you will support Python 3. "Required Dependencies# Anaconda.
Python 2.7 version is needed for Caffe2, and Anaconda is recommended."

~~~
jiayq84
Thanks - Python 3 support is coming soon, as you may expect, there are a few
issues regarding string manipulation but we are figuring out the details.

------
mark_l_watson
I was looking for documentation for creating bindings to other programming
languages. Any suggestions? Thanks!

~~~
gumby
try SWIG: [http://www.swig.org](http://www.swig.org)

~~~
mark_l_watson
Thanks, I am reading through the documentation now.

------
hengck23
One quick question: will nivida tensorRT be supporting caffe2?

~~~
jiayq84
TensorRT currently is supporting Caffe; it would definitely be interesting to
make a direct Caffe2 compatibility support.

------
kelisv
Great work! Question: Can we implement GAN using caffe2?

