-
Notifications
You must be signed in to change notification settings - Fork 19.7k
3D CNN layers with an example #718
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
Conversation
|
Could you add a docstring to the example explaining what it does, how long it takes to train and how well it performs? Likewise for the dataset, it would require more explicit context. |
|
Added comments in the example and dataset file. |
keras/datasets/shapes_3d.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to put this text in a docstring.
|
I see that the convolution2D has been upgraded to cuDNN backend. I believe it would be consistent to upgrade the convolution3D too before the merge. |
|
Hi, I have upgraded the conv3d layer and maxpool 3d to the latest keras Thanks, On Tue, Oct 27, 2015 at 11:00 AM, kleinash [email protected] wrote:
|
|
Does this code offer support for multiple channels? For 2D image data, we often have RGB channels, so the actual size of a 2D, 256 pixel image would be (256, 256, 3). For 3D data, is it possible to have multiple channels for the convolution? For example, if we have RGB channels in 3D, then the actual size of a sample grid would be (32, 32, 32, 3). |
|
I just realized that I forgot to thank @MinhazPalasara for the great work in putting together this PR. I've been using it for my research, and it's saved me a tremendous amount of time in getting things off the ground! To answer my own question above, yes this PR does support multiple 3D channels. However, the required input shape is arcane. The input training data X must be of shape For comparison, the cifar10 example in examples/cifar10_cnn.py generates training data X of shape Could you update Convolution3D to expect an input array of form to match the other cnn example? This is just a suggestion, and perhaps @fchollet or other keras maintainers would have more insight into the correct input format. |
That would definitely be necessary, for consistency with the API of There are only two input formats that would make sense:
But since we are already using the first format for our other convolution layers, that's a no-brainer. |
|
I took care of the argument order in the latest changes. Additionally, I was hopping to add the dnn conv3d to the functionality, but it seems conv3d in dnn is not exposed to theano as yet. So, I would commit the support for cpu and gpu(without dnn backbone) right away. Thanks, |
|
@minhaz I get a shape mismatch exception who I use convolution3D layers with border_mode='full' Have you tested this? |
|
Hi nerduno, the functions I have used in this PR don't support any other mode than valid. I will, in a day, commit new changes with all the modes. That is the only thing left, I am currently testing that. Give me a day. |
|
Hi @MinhazPalasara, do you have any news on your 3d layers? I would love to try (and use) them :) |
|
I've been using this PR in my pipeline, and I've discovered (and fixed) a few minor bugs associated with saving and loading Convolution3D layers. @fchollet, @MinhazPalasara : Is there a standard procedure in place for fixing bugs in an outstanding PR? I could create a new PR based off this one, which could be subsequently closed once the bugfixes are merged into this PR. I'm open to any other suggestions on how to get the bugfixes merged in here. |
|
Sorry guys, |
f0e728a to
febc604
Compare
|
@fchollet this branch is up to date with the new keras standards!! Conv3D is supported in gpu and cpu with all possible border modes. cudnn 3D (conv and pooling) is not supported by theano yet, will try to expose that first and then will update keras. While developing the "same" border mode for convolution3D, I found a bug in Convolution2D. For the same mode the size of output image is not same. I am logging an issue for that. |
|
Hey is there any update on this PR? |
|
I've been using this PR in my ML pipeline. For the most part it seems to work, though I had to make a few fixes:
to include fields for super class It would be awesome, @MinhazPalasara and @fchollet , if this PR could be merged soon. I'm glad to help with testing if it would facilitate the process. |
|
Yeah +1. This would be very useful and I'm happy to help with testing or docs. |
|
@evanfeinberg I will do changes as per your suggestions shortly. It would be great if you could/point me to some open source 3D data that could be a good example for this PR. |
|
Thanks, @jbencook and @MinhazPalasara ! @rbharath , do you have any suggestions for pertinent open source 3D data? |
|
I think the modelnet database would be a good open-source example of 3D data. |
|
To make this work with both backends, it might be possible to rewrite Theano's conv3d2d (https://github.com/Theano/Theano/blob/master/theano/tensor/nnet/conv3d2d.py#L170) using Keras's backend-agnostic operators |
|
I am not able to find Convolution3D layer in convolution.py file. Also there is no defination in the docs also. How can I use this layer and how can I define it in my CNN architecture?? I am working with Medical Images so for that this layer is necessary |
|
You want to check out this PR locally (see https://gist.github.com/piscisaureus/3342247 for a guide on how to do that). |
|
Hi, is there anyone working on improving this PR to the up-to-date api of keras? If not, I would try to work on it. |
|
@oeway @evanfeinberg, I am working on making this PR up to date. Unfortunately tensor flow and theano (cuDnn 3D is not exposed in theano) have no convolution 3D. I am working on pushing changes in those libraries first. In mean time, I could push 3D support for only theano backend. |
|
@MinhazPalasara (cc @oeway @evanfeinberg): It would be great to get some reasonable implementation of this PR merged into keras as soon as possible without waiting for conv3D support in tensorflow/theano. I personally need some extra features on top of a vanilla 3D CNN, but I'm blocked from adding these features to keras since this PR has been open for so long... |
|
I'd love to see this PR completed! Correct me if I'm wrong, but according to these Theano docs it looks like Theano does expose some 3DConvolutional methods, at least for 0.7. |
|
I am working on this too, and now I am testing the code, should be ready soon. At the moment, only theano backend is implemented, if anyone can help on the convolution3d implementation on tensorflow, it would be perfect. @MinhazPalasara , are you also working on tensorflow? If yes, that would be great, and I could taken care of the updates from the keras side. Details about convolution3d in theano: There are two implementations available in theano, I used Notice that there are precision differences with As you can see, |
|
Hi, |
|
@rbharath @nerduno @mrwns @evanfeinberg @jbencook @imraghs @StephanHeijl See PR #1623 for more information. |
|
👍 thanks! |
No description provided.