Giter VIP home page Giter VIP logo

textcaps's People

Contributors

vinojjayasundara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

textcaps's Issues

Shape must be rank 4 but is rank 5 for 'digitcaps/Tile_1' (op: 'Tile') with input shapes: [1,47,1,16], [5].

Traceback (most recent call last):
File "/Users/kumararnav/PycharmProjects/textcaps-master/myenv/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1864, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 4 but is rank 5 for 'digitcaps/Tile_1' (op: 'Tile') with input shapes: [1,47,1,16], [5].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "textcaps_emnist_bal.py", line 449, in
routings=args.routings)
File "textcaps_emnist_bal.py", line 47, in CapsNet
digitcaps = CapsuleLayer(num_capsule=n_class, dim_capsule=16, routings=routings,channels=32,name='digitcaps')(primarycaps)
File "/Users/kumararnav/PycharmProjects/textcaps-master/myenv/lib/python3.7/site-packages/keras/engine/base_layer.py", line 451, in call
output = self.call(inputs, **kwargs)
File "/Users/kumararnav/PycharmProjects/textcaps-master/capsulelayers.py", line 141, in call
B_tiled = tf.tile(B_expanded, [tf.shape(inputs_hat)[0], 1, self.input_num_capsule, 1, 1])
File "/Users/kumararnav/PycharmProjects/textcaps-master/myenv/lib/python3.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 10903, in tile
"Tile", input=input, multiples=multiples, name=name)
File "/Users/kumararnav/PycharmProjects/textcaps-master/myenv/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/Users/kumararnav/PycharmProjects/textcaps-master/myenv/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/Users/kumararnav/PycharmProjects/textcaps-master/myenv/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 3616, in create_op
op_def=op_def)
File "/Users/kumararnav/PycharmProjects/textcaps-master/myenv/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 2027, in init
control_input_ops)
File "/Users/kumararnav/PycharmProjects/textcaps-master/myenv/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1867, in _create_c_op
raise ValueError(str(e))
ValueError: Shape must be rank 4 but is rank 5 for 'digitcaps/Tile_1' (op: 'Tile') with input shapes: [1,47,1,16], [5].

Original images are not used in re-training decoder?

According to the paper, it says that the original images and sharpened reconstructed images are combined and used as new training set for decoder retraining.
But in your code only the sharpened reconstructed images are used as re-train dataset, was it out of actual experiment purpose to leave the original images out?

ValueError: Dimensions must be equal, but are 128 and 47 for 'digitcaps/add' (op: 'Add') with input shapes: [?,47,47,128,16], [47,16].

The code works fine on CPU
I get this error when I run on my Server with GPU

$python textcaps_emnist_bal.py --cnt 200
Using TensorFlow backend.
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING:tensorflow:From textcaps_emnist_bal.py:28: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

WARNING:tensorflow:From textcaps_emnist_bal.py:30: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

2020-01-02 13:21:33.574399: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-01-02 13:21:33.581028: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1
2020-01-02 13:21:35.776981: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-01-02 13:21:35.777487: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4cafca0 executing computations on platform CUDA. Devices:
2020-01-02 13:21:35.777514: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): Tesla K80, Compute Capability 3.7
2020-01-02 13:21:35.798958: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300090000 Hz
2020-01-02 13:21:35.799325: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4d21010 executing computations on platform Host. Devices:
2020-01-02 13:21:35.799347: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): ,
2020-01-02 13:21:35.799567: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-01-02 13:21:35.799986: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235
pciBusID: 0000:00:1e.0
2020-01-02 13:21:35.800124: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib:/usr/local/cuda-9.0/lib64
2020-01-02 13:21:35.800212: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib:/usr/local/cuda-9.0/lib64
2020-01-02 13:21:35.800294: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib:/usr/local/cuda-9.0/lib64
2020-01-02 13:21:35.800372: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib:/usr/local/cuda-9.0/lib64
2020-01-02 13:21:35.800452: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib:/usr/local/cuda-9.0/lib64
2020-01-02 13:21:35.800521: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib:/usr/local/cuda-9.0/lib64
2020-01-02 13:21:35.802903: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7
2020-01-02 13:21:35.802928: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1663] Cannot dlopen some GPU libraries. Skipping registering GPU devices...
2020-01-02 13:21:35.802950: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-01-02 13:21:35.802970: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187] 0
2020-01-02 13:21:35.802979: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0: N
Namespace(batch_size=32, cnt=200, data_generate=False, epochs=60, lam_recon=0.392, lr=0.001, lr_decay=0.9, num_cls=47, routings=3, samples_to_generate=10, save_dir='./emnist_bal_200', shift_fraction=0.1, verbose=False, weights=None)
(9400, 28, 28, 1) (9400, 47) (18800, 28, 28, 1) (18800, 47)
WARNING:tensorflow:From /home/app-admin/Lalith_Avinash/textcaps/capsulelayers.py:136: calling softmax (from tensorflow.python.ops.nn_ops) with dim is deprecated and will be removed in a future version.
Instructions for updating:
dim is deprecated, use axis instead
Traceback (most recent call last):
File "/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 1864, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 128 and 47 for 'digitcaps/add' (op: 'Add') with input shapes: [?,47,47,128,16], [47,16].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "textcaps_emnist_bal.py", line 449, in
routings=args.routings)
File "textcaps_emnist_bal.py", line 47, in CapsNet
digitcaps = CapsuleLayer(num_capsule=n_class, dim_capsule=16, routings=routings,channels=32,name='digitcaps')(primarycaps)
File "/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/keras/engine/base_layer.py", line 489, in call
output = self.call(inputs, **kwargs)
File "/home/app-admin/Lalith_Avinash/textcaps/capsulelayers.py", line 137, in call
outputs = squash(K.batch_dot(c, inputs_hat, [2, 2])+ self.B)
File "/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/ops/math_ops.py", line 897, in binary_op_wrapper
return func(x, y, name=name)
File "/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/ops/gen_math_ops.py", line 387, in add
"Add", x=x, y=y, name=name)
File "/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 3616, in create_op
op_def=op_def)
File "/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 2027, in init
control_input_ops)
File "/home/app-admin/Lalith_Avinash/textcaps/venv/lib64/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 1867, in _create_c_op
raise ValueError(str(e))
ValueError: Dimensions must be equal, but are 128 and 47 for 'digitcaps/add' (op: 'Add') with input shapes: [?,47,47,128,16], [47,16].

Getting ValueError when calling train

When caling python textcaps_emnist_bal.py --cnt 200 I get:
ValueError: Dimensions must be equal, but are 128 and 47 for 'digitcaps/add_8' (op: 'Add') with input shapes: [?,47,47,128,16], [47,16].
at location
outputs = squash(K.batch_dot(c, inputs_hat, [2, 2])+ self.B)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.