Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation listing supported layers for Keras, Caffe and TensorFlow #409

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Documentation listing supported layers for Keras, Caffe and TensorFlow #409

wants to merge 12 commits into from

Conversation

Azamlynny
Copy link

No description provided.

@thatbrguy
Copy link
Contributor

@Azamlynny That's a very neat documentation, good job! I have a few suggestions before we can approve this:

  • Place the documentation in docs/source. That's where most of our documentation is.
  • Link this documentation to our README.md file.
  • Please open a new PR with the graph reset functionality that you added for your previous task. Looks like you closed the old one and did not create another PR for graph reset.

Copy link
Member

@Ram81 Ram81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Azamlynny good work, few comments

### Custom Layers
| Caffe | Keras | Tensorflow |
| :-----------: | :----------: | :---------: |
| √ | √ | Use Keras API for custom layers |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add LRN as an example in custom layers supported.

## Additional Notes:
* Keras does not support the LRN layer used in Alexnet & many other models. To use the LRN layer refer to here: https://github.com/Cloud-CV/Fabrik/blob/master/tutorials/keras_custom_layer_usage.md.
* Documentation for writing your own Keras layers is found here: https://keras.io/layers/writing-your-own-keras-layers/
* Caffe 3D layers can be used in Caffe 2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't tested any features for caffe 2.0 yet, have you tested this if not we can drop this line.

* Caffe 3D layers can be used in Caffe 2.0

## Documentation for Caffe, Keras, and Tensorflow layers
* Documentation for all Keras Layers is found here: https://keras.io/layers/about-keras-layers/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a markdown link on here.


## Documentation for Caffe, Keras, and Tensorflow layers
* Documentation for all Keras Layers is found here: https://keras.io/layers/about-keras-layers/
* Documentation for all Caffe Layers is found here: http://caffe.berkeleyvision.org/tutorial/layers.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

## Documentation for Caffe, Keras, and Tensorflow layers
* Documentation for all Keras Layers is found here: https://keras.io/layers/about-keras-layers/
* Documentation for all Caffe Layers is found here: http://caffe.berkeleyvision.org/tutorial/layers.html
* Documentation for all Tensorflow Layers is found here: https://www.tensorflow.org/api_docs/python/tf/layers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


## Additional Notes:
* Keras does not support the LRN layer used in Alexnet & many other models. To use the LRN layer refer to here: https://github.com/Cloud-CV/Fabrik/blob/master/tutorials/keras_custom_layer_usage.md.
* Documentation for writing your own Keras layers is found here: https://keras.io/layers/writing-your-own-keras-layers/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a markdown link on here.

| :-----------: | :----------: | :---------: |
| √ | √ | Use Keras API for custom layers |

## Additional Notes:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a markdown link on here.

@@ -0,0 +1,176 @@
# Layers supported in Caffe, Keras, and Tensorflow
Below is are table showing which layers are supported by Caffe, Keras, and Tensorflow:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammatical mistake.

| ZeroPadding 3D | × | √ | √ |
| Im2Col | √ | × | × |
| Spatial Pyramid Pooling | √ | × | × |
* Upsampling in Caffe can be done by using methods shown here: https://gist.github.com/tnarihi/54744612d35776f53278
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add as a markdown link on here

### Custom Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------: | :----------: | :---------: | :---------: |
| Custom Layers | √ | √ | Use Keras API for custom layers |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to mention custom layers explicitly

@Ram81
Copy link
Member

Ram81 commented Oct 31, 2018

@Azamlynny minor changes

@yashdusing
Copy link
Contributor

Also, could you please specify how you've tested the layers and the procedure used. We will need to cross verify it once on our end as well before approving the PR. A code template would be helpful as well .

@thatbrguy
Copy link
Contributor

@Azamlynny Please add a section for Data layers. I've just pasted the layers here for your reference:

data

Copy link
Contributor

@thatbrguy thatbrguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, impressive work so far. Made some minor changes.

| Data | √ | √ | √ | √ | √ | √ |
| HDF5 Data | √ | √ | √ | √ | √ | √ |
| HDF5 Output Data | √ | √ | √ | √ | √ | √ |
| Input | √ | √ | √ | √ | √ | √ |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i remember correctly, for Keras and Tensorflow (in Fabrik) only Input is available. All other data layers are not available.

| Log | √ | √ | × | √ | × | × |
| BNLL | √ | × | × | √ | × | × |
| Bias | √ | × | × | √ | √ | √ |
| Scale | √ | × | × | √ | √ | √ |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Scale is Caffe only (in Fabrik)

| Eltwise | √ | × | × | √ | √ | √ |
| Parameter | √ | × | × | √ | × | √ |
| Reduction | √ | × | × | √ | × | × |
| Silence | √ | × | × | × | × | × |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fabrik Caffe does has silence.

### Loss Layers
| Layer | Caffe | Keras | Tensorflow | Fabrik Caffe | Fabrik Keras | Fabrik Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: | :-----------: | :--------------: | :-----------------: |
| Multinomial Logistic Loss | √ | × | × | × | × | × |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fabrik caffe has this layer

| Multinomial Logistic Loss | √ | × | × | × | × | × |
| Infogain Loss | √ | × | × | √ | × | × |
| Softmax with Loss | √ | × | √ | √ | × | × |
| Sum-of-Squares/Euclidean | √ | × | × | × | × | × |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fabrik caffe has this layer

| Softmax with Loss | √ | × | √ | √ | × | × |
| Sum-of-Squares/Euclidean | √ | × | × | × | × | × |
| Hinge / Margin | √ | √ | √ | √ | × | × |
| Sigmoid Cross-Entropy Loss| √ | × | √ | × | × | × |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fabrik caffe has this layer

@thatbrguy
Copy link
Contributor

@Azamlynny Excellent work so far! That's a very neat documentation.

I've posted a review with some changes. @yashdusing Can you just verify if I have not missed something?

@yashdusing
Copy link
Contributor

yashdusing commented Nov 5, 2018

Hello @Azamlynny . Pretty good work so far. Few changes though (I've attached a screenshot completing the core layers) :

  • follow the format as show in picture i.e. if layer is keras only or caffe only then mention it in bracket. If layer is keras only, then even tensorflow would support it through keras API so mention keras in tensorflow column. If layer is supported in all of the frameworks (for eg. dropout), keep it as blank (i.e. don't add in brackets). Also, please refer the documentations for the frameworks before marking it as done. While caffe does have activation layers, it does not have a separate activation layer like keras does and has a separate layer for each of them which are mentioned layer (relu, sigmoid, tanH, etc) so activation layer should be crossed in caffe column.
  • Reference :
  1. For caffe : http://caffe.berkeleyvision.org/tutorial/layers.html
  2. For keras : https://keras.io/
  3. For tensorflow 1.4 : https://github.com/tensorflow/docs/blob/r1.4/site/en/api_docs/api_docs/python/index.md
  4. For Fabrik caffe : data.js
  5. For Fabrik Keras : Fabrik's keras app's import, export files
  6. For Fabrik Tensorflow : import_graphdef.py
    screenshot_20181105_123113

(EDIT:

  1. Also for layers having different names in caffe and keras, like inner product, mention Keras's layer name in Keras section (dense in this case)
  2. ActivityRegularization is a keras only layer so caffe column should be crossed as well contrary to what is shown in image.
    )

@yashdusing
Copy link
Contributor

@Ram81 @thatbrguy Please look into the format of the screenshot I posted and see if I missed something out or any changes are needed.

@thatbrguy
Copy link
Contributor

@yashdusing I think we'll just mention the different names across platforms in brackets. (Inner-Product vs Dense). Let's not mention keras in the TensorFlow section for now. We'll have a separate task to deal with supported tensorflow APIs.

@Azamlynny Also, looks like inner-product is crossed out for Caffe. It's available on caffe so please modify that

@Azamlynny
Copy link
Author

@yashdusing I think we'll just mention the different names across platforms in brackets. (Inner-Product vs Dense). Let's not mention keras in the TensorFlow section for now. We'll have a separate task to deal with supported tensorflow APIs.

I am not sure by what you mean by mention the different names across platforms in brackets. Where would you want this? In the Layer column, or in the actual Caffe and Keras columns and if in these locations what would the layer column be called?

@thatbrguy
Copy link
Contributor

@Azamlynny Actually the table looks neater with just ticks. So, if you notice any layer available in Caffe as well as Keras or Tensorflow, with just different names (but mapped to the same Fabrik layer name) you can add it to the notes section after the table

### Locally-connected Layers
| Layer | Caffe | Keras | Tensorflow | Fabrik Caffe | Fabrik Keras | Fabrik Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: | :-----------: | :--------------: | :-----------------: |
| LocallyConnected1D | × | √ | √ | × | √ | √× |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there both √× in the Fabrik Tensorflow section?

| Stochastic Pooling | √ | × | × | √ | × | × |

### Data Layers
| Layer | Caffe | Keras | Tensorflow | Fabrik Caffe | Fabrik Keras | Fabrik Tensorflow |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also tell me why we have 6 columns two for each layer?
I think only mentioning which layers for a framework does Fabrik support is good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants