GithubHelp home page GithubHelp logo

deeplearningturkiye / kapsul-agi-capsule-network Goto Github PK

View Code? Open in Web Editor NEW
42.0 11.0 14.0 36 KB

Prof. Geoffrey Hinton’ın “Dynamic Routing Between Capsules” makalesindeki Kapsül Ağı (Capsule Network: CapsNet) algoritmasının Keras Uygulamasıdır.

Python 100.00%
geoffrey-hinton kapsul-agi capsule-networks

kapsul-agi-capsule-network's People

Contributors

deeplearningturkiye avatar yavuzkomecoglu 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kapsul-agi-capsule-network's Issues

Boyut Hatası

İyi Çalışmalar.

Normal şartlarda kodu kendim alıp modifiye ettiğim halinde el yapımı bir veri kümesinde başarı ile çalıştırdım. Fakat Mnist içinde denemek istedim. Kodu tavsiye ettiğiniz şekillde çalıştırınca ;

tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 1152 and 16 for 'digitcaps/add_2' (op: 'AddV2') with input shapes: [?,10,?,1152], [?,10,10,1152,16,10,?,16].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "capsulenet.py", line 206, in
num_routing=args.num_routing)
File "capsulenet.py", line 44, in CapsNet
name='digitcaps')(primarycaps)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/base_layer.py", line 451, in call
output = self.call(inputs, **kwargs)
File "/content/kapsul-agi-capsule-network/capsulelayers.py", line 167, in call
b += K.batch_dot(outputs, inputs_hat_stopped, [2, 3])
File "/tensorflow-1.15.0/python3.6/tensorflow_core/python/ops/math_ops.py", line 899, in binary_op_wrapper
return func(x, y, name=name)
File "/tensorflow-1.15.0/python3.6/tensorflow_core/python/ops/math_ops.py", line 1197, in _add_dispatch
return gen_math_ops.add_v2(x, y, name=name)
File "/tensorflow-1.15.0/python3.6/tensorflow_core/python/ops/gen_math_ops.py", line 549, in add_v2
"AddV2", x=x, y=y, name=name)
File "/tensorflow-1.15.0/python3.6/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper
op_def=op_def)
File "/tensorflow-1.15.0/python3.6/tensorflow_core/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/tensorflow-1.15.0/python3.6/tensorflow_core/python/framework/ops.py", line 3357, in create_op
attrs, op_def, compute_device)
File "/tensorflow-1.15.0/python3.6/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal
op_def=op_def)
File "/tensorflow-1.15.0/python3.6/tensorflow_core/python/framework/ops.py", line 1770, in init
control_input_ops)
File "/tensorflow-1.15.0/python3.6/tensorflow_core/python/framework/ops.py", line 1610, in _create_c_op
raise ValueError(str(e))
ValueError: Dimensions must be equal, but are 1152 and 16 for 'digitcaps/add_2' (op: 'AddV2') with input shapes: [?,10,?,1152], [?,10,10,1152,16,10,?,16].

Şu Hatayı aldım. Çözmeye uğraşacağım. Bilginize. Ellerinize sağlık

TypeError: unsupported operand type(s)

Kodu olduğu gibi, üzerinde hiçbir değişiklik yapmadan çalıştırmak istediğimde "TypeError: unsupported operand type(s) for *=: 'int' and 'NoneType'" hatası aldım. Traceback aşağıdaki gibidir.

Sorunun kaynadığını henüz bulamadım. Bulan ve çözen olursa yardımcı olabilirse çok sevinirim.

Traceback (most recent call last):
File "capsulenet.py", line 206, in
model, eval_model = CapsNet(input_shape=x_train.shape[1:],
File "capsulenet.py", line 43, in CapsNet
digitcaps = CapsuleLayer(num_capsule=n_class, dim_capsule=16, num_routing=num_routing,
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 897, in call
self._maybe_build(inputs)
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 2416, in _maybe_build
self.build(input_shapes) # pylint:disable=not-callable
File "/storage/selin/Works/kapsul-agi-capsule-network/capsulelayers.py", line 112, in build
self.W = self.add_weight(shape=[self.num_capsule, self.input_num_capsule,
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 560, in add_weight
variable = self._add_variable_with_custom_getter(
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/training/tracking/base.py", line 738, in _add_variable_with_custom_getter
new_variable = getter(
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer_utils.py", line 129, in make_variable
return tf_variables.VariableV1(
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/ops/variables.py", line 259, in call
return cls._variable_v1_call(*args, **kwargs)
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/ops/variables.py", line 205, in _variable_v1_call
return previous_getter(
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/ops/variables.py", line 198, in
previous_getter = lambda **kwargs: default_variable_creator(None, **kwargs)
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/ops/variable_scope.py", line 2584, in default_variable_creator
return resource_variable_ops.ResourceVariable(
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/ops/variables.py", line 263, in call
return super(VariableMetaclass, cls).call(*args, **kwargs)
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1423, in init
self._init_from_args(
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1567, in _init_from_args
initial_value() if init_from_fn else initial_value,
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer_utils.py", line 121, in
init_val = lambda: initializer(shape, dtype=dtype)
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/ops/init_ops_v2.py", line 545, in call
fan_in, fan_out = _compute_fans(scale_shape)
File "/storage/selin/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/ops/init_ops.py", line 1422, in _compute_fans
receptive_field_size *= dim
TypeError: unsupported operand type(s) for *=: 'int' and 'NoneType'

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.