DoDuy / Lung-Diseases-Classifier

Diseases Detection from NIH Chest X-ray data
Apache License 2.0
76 stars 31 forks source link

I am getting error while executing Capsule Network basic - SampleDataset.ipynb. #5

Closed siddarthjha closed 3 years ago

siddarthjha commented 3 years ago

File "cnbs.py", line 102, in model, eval_model, manipulate_model = CapsNet(input_shape=train_tensors.shape[1:], File "cnbs.py", line 71, in CapsNet digitcaps = CapsuleLayer(num_capsule=n_class, dim_capsule=16, routings=routings, File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 897, in call self._maybe_build(inputs) File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 2416, in _maybe_build self.build(input_shapes) # pylint:disable=not-callable File "C:\Users\Sid\Documents\Lung-Diseases-Classifier-master 2\capsulelayers.py", line 105, in build self.W = self.add_weight(shape=[self.num_capsule, self.input_num_capsule, File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 560, in add_weight variable = self._add_variable_with_custom_getter( File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\training\tracking\base.py", line 738, in _add_variable_with_custom_getter new_variable = getter( File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\keras\engine\base_layer_utils.py", line 129, in make_variable return tf_variables.VariableV1( File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\ops\variables.py", line 259, in call return cls._variable_v1_call(*args, kwargs) File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\ops\variables.py", line 205, in _variable_v1_call return previous_getter( File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\ops\variables.py", line 198, in previous_getter = lambda kwargs: default_variable_creator(None, *kwargs) File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 2584, in default_variable_creator return resource_variable_ops.ResourceVariable( File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\ops\variables.py", line 263, in call return super(VariableMetaclass, cls).call(args, *kwargs) File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py", line 1423, in init self._init_from_args( File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\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 "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\keras\engine\base_layer_utils.py", line 121, in init_val = lambda: initializer(shape, dtype=dtype) File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\ops\init_ops_v2.py", line 542, in call fan_in, fan_out = _compute_fans(scale_shape) File "C:\Users\Sid\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\ops\init_ops_v2.py", line 1015, in _compute_fans receptive_field_size = dim TypeError: unsupported operand type(s) for *=: 'float' and 'NoneType'

dhruvmsheth commented 3 years ago

Can you confirm which Tensorflow and keras version you are using

siddarthjha commented 3 years ago

tensorflow = 2.3.1 keras = 2.4.3

dhruvmsheth commented 3 years ago

Try changing Tensorflow version lower than 2.0 either 1.2 or 1.8

siddarthjha commented 3 years ago

can you help me with the pip command for downgrading TensorFlow to the required version

dhruvmsheth commented 3 years ago

pip install tensorflow==1.8.0

siddarthjha commented 3 years ago

ERROR: Could not find a version that satisfies the requirement tensorflow==1.8.0 ERROR: No matching distribution found for tensorflow==1.8.0

dhruvmsheth commented 3 years ago

If you are using python3, use pip3 install tensorflow==1.8.0