ibm / matrix-capsules-with-em-routing Goto Github PK
View Code? Open in Web Editor NEWA TensorFlow implementation of "Matrix Capsules with EM Routing" by Hinton et al. (2018).
License: Apache License 2.0
A TensorFlow implementation of "Matrix Capsules with EM Routing" by Hinton et al. (2018).
License: Apache License 2.0
Great realization, great work!!
Hi Ashley,
In layers.py, 'def fc_caps( )' creat spatial_routing_matrix with 'spatial_routing_matrix = utl.create_routing_map(child_space=1, k=1, s=1)' , where child_space is 1, but i think it's not necessary to be 1 over this point, you know along the tensor shape alteration flow before (64, 7, 7, 8, *) ---> (64, 5, 5, 16, *) , the child_space should be 5 instead of 1.
And with child_space=1, the newly generated spatial_routing_matrix has shape (1,1), that will make the 'em_routing()' thereafter incorrect.
How do you think about that? maybe my reasoning is wrong somewhere?
Kindly regards
Jeff
Hello all :)
Iโm trying to use Routing by agreement with TRANSFORMER-BASED for NMT task. The proposed idea is to use each output of head attention as an input capsule for a capsule network to fuse the semantic and spatial information from different heads to help boost the correction of sentence output. As below:
The implementation code is here, and Pytorch issue is here.
I have got so bad results. Kindly, I need and suggestion to work on.
I look forward to your feedback.
Hi Ashley,
Thanks for your great work.
When I ran the code, it failed with below information:
My computer system information:
Linux Ubuntu 16.04
Nvidia GPU GeForce GTX 1070, 8G
CUDA 9.0/cuDNN 7.3
Python 3.6.8
Tensorflow version: 1.11.0-gpu
I met this problem first time with CUDA 9.2 and cuDNN 7.6, I downgraded them to CUDA 9.0 and cuDNN 7.3, but still has this issue.
I also tried to reduce 'bath_size' from 64 to 2, but still have the same problem. Any idea, why it failed?
Hi guys,
When I try to continue to train the network from a ckpt_dir, I use the flag "load_dir" to do that.
python3 train_val.py --load_dir=./logs/smallNORB/20200103_/train/checkpoint
But the code returns:
"load_ckpt directory exists but cannot find a valid
checkpoint to resore, consider using the reset flag"
I have checked the dir and there is some checkpoints from previous training.
Is there some mistakes that I made in this process?
Hi Ashley,
For 'def m_step()' in em_routing.py, I can see you code 'cost_j_h = (beta_v + 0.5tf.log(var_j)) * rr_prime_sum * layer_norm_factor' prior 'cost_j = tf.reduce_sum(cost_j_h, axis=-1, keepdims=True, name="cost_j")' .
My question is whether this lead to beta_v been multiplied by 'h' times? because 'beta_v + 0.5tf.log(var_j)' will broadcast beta_v over all the h elements along the last dimension.
According formula (2) in 'M ATRIX CAPSULES WITH EM
ROUTING' paper, it should be put something like (beta_v + Sum of cost_j_h) instead of Sum of (beta_v + cost_j_h), how do you think? maybe i am wrong.
Kindly regards
Jeff
I try to use pip install -r requirements.txt
to install the dependencies.
However, some requirements are not met:
mkl-fft==1.0.12 (only 1.0.6 is available)
mkl-random==1.0.2 (only 1.0.1.1)
mkl-service==2.0.2 (not found)
Dear Ashley,
Thanks for your work fixing some common mistakes in other open source implementations. I found that the validation set was selected from the test set according to the proportion of 10%. Does this lead to an inaccurate test result?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.