Comments (4)
@wensdong Thanks for asking. Firstly, I didn't test the speed of naturomics/CapsNet-Tensorflow
. I only test my code on a single GTX 1070 GPU card and the running speed is about 120s / epoch
. Then, if it is true about your speed test, I do not think it's due to Keras. Maybe it's because the different implementation of routing algorithm (I used pure matrix computation, naturomics used iteration for capsules in the next layer), though I didn't test it.
At last, I'll give free publicity for Keras. It is a higher level API built up on TF/Theano/CNTK. It is very easy to use. From TensorFlow 1.4, keras has been added to the core code, you can use keras by from tensorflow import keras
. I have adapted the Keras code to tensorflow.keras which can be found here:
CapsNet-tf1.4-keras.zip
from capsnet-keras.
@wensdong I didn't use other loops.
- I just tested the two version of
inputs_hat
computation. It shows the V2 is faster than V1 by 50s. - The 3 iterations in the routing algorithm is inevitable.
num_routing=3
(117s) takes about 12s more thannum_routing=1
(105s). - Other parts are not tested. But I believe that any explicit iterations should be avoided as much as possible.
PS. A little trick: the progress bar can show normally by enlarging the terminal window.
from capsnet-keras.
Are you sure that both cases were running on the same cpu/gpu ? That's often an explanation for huge difference in training speed.
from capsnet-keras.
Hi Jesff,
I run both codes on same P2 instance. The Naturomics' run about 10+ minutes per epoch, while the Xifeng's run about 2+ minutes per epoch. I did it twice to make sure I was not confused something. I actually tried P3 instance for Naturomics's with no luck, then I started to try others.
Following screenshots for both code executions.
@ Xifeng,
The speed issue normally caused by loops, vectorization normally speed up things very quickly. I did not find any loops in your code except the routing part (funny is that version 2 is indeed use loops, and appear to be faster. Please find below screenshot). Is there any other places you did loops implicitly?
Regards,
from capsnet-keras.
Related Issues (20)
- Problems with muligpu
- pydot
- A TypeError occurred while running this code in Colab HOT 1
- Question about trained_model.h5 HOT 1
- length prediction per image > 1
- Issue on manipulate_latent(manipulate_model, (x_test, y_test), args) at tf 2.2 gpu HOT 1
- ist
- How to change the input layer dimension HOT 2
- ValueError: Layer model expects 2 input(s), but it received 4 input tensors. HOT 11
- Training interrupted after first epoch HOT 1
- What means by parser.add_argument('--digit', default=5, type=int, # help="Digit to manipulate") ?
- fine tune
- Does any one has manipulate question? HOT 1
- Can not do batch_dot
- low accuracy- high accuracy unstable model
- TypeError: ('Keyword argument not understood:', 'num_routing')
- Capsnet_accuracy low 0.98
- TypeError in a tf file
- Question consultation
- ValueError: Cannot do batch_dot on inputs with shapes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capsnet-keras.