Keras_HED_with_model icon indicating copy to clipboard operation
Keras_HED_with_model copied to clipboard

ValueError: None values not supported.

Open zp946 opened this issue 4 years ago • 0 comments

model.compile ERROR

ValueError Traceback (most recent call last) E:\python program\Keras_HED_with_model-master\main_segmentation.py in 40 41 # model ---> 42 model = hed() 43 plot_model(model, to_file=os.path.join(model_dir, 'model.png'), show_shapes=True) 44

E:\python program\Keras_HED_with_model-master\src\networks\hed.py in hed() 74 'o5': cross_entropy_balanced, 75 'ofuse': cross_entropy_balanced, ---> 76 },metrics={'ofuse': ofuse_pixel_error},optimizer='adam') 77 78 return model

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\keras\backend\tensorflow_backend.py in symbolic_fn_wrapper(*args, **kwargs) 73 if _SYMBOLIC_SCOPE.value: 74 with get_graph().as_default(): ---> 75 return func(*args, **kwargs) 76 else: 77 return func(*args, **kwargs)

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\keras\engine\training.py in compile(self, optimizer, loss, metrics, loss_weights, sample_weight_mode, weighted_metrics, target_tensors, **kwargs) 227 # loss_weight_2 * output_2_loss_fn(...) + 228 # layer losses. --> 229 self.total_loss = self._prepare_total_loss(masks) 230 231 # Functions for train, test and predict will

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\keras\engine\training.py in _prepare_total_loss(self, masks) 690 691 output_loss = loss_fn( --> 692 y_true, y_pred, sample_weight=sample_weight) 693 694 if len(self.outputs) > 1:

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\keras\losses.py in call(self, y_true, y_pred, sample_weight) 69 scope_name = 'lambda' if self.name == '' else self.name 70 with K.name_scope(scope_name): ---> 71 losses = self.call(y_true, y_pred) 72 return losses_utils.compute_weighted_loss( 73 losses, sample_weight, reduction=self.reduction)

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\keras\losses.py in call(self, y_true, y_pred) 130 Loss values per sample. 131 """ --> 132 return self.fn(y_true, y_pred, **self._fn_kwargs) 133 134 def get_config(self):

E:\python program\Keras_HED_with_model-master\src\networks\hed.py in cross_entropy_balanced(y_true, y_pred) 101 pos_weight = beta / (1 - beta) 102 --> 103 cost = tf.nn.weighted_cross_entropy_with_logits(labels=None,logits=y_pred,pos_weight=pos_weight) 104 105 # Multiply by 1 - beta

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\tensorflow_core\python\ops\nn_impl.py in weighted_cross_entropy_with_logits_v2(labels, logits, pos_weight, name) 297 with ops.name_scope(name, "logistic_loss", [logits, labels]) as name: 298 logits = ops.convert_to_tensor(logits, name="logits") --> 299 labels = ops.convert_to_tensor(labels, name="labels") 300 try: 301 labels.get_shape().merge_with(logits.get_shape())

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\tensorflow_core\python\framework\ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, dtype_hint, ctx, accepted_result_types) 1312 1313 if ret is None: -> 1314 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) 1315 1316 if ret is NotImplemented:

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\tensorflow_core\python\framework\constant_op.py in _constant_tensor_conversion_function(v, dtype, name, as_ref) 315 as_ref=False): 316 _ = as_ref --> 317 return constant(v, dtype=dtype, name=name) 318 319

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\tensorflow_core\python\framework\constant_op.py in constant(value, dtype, shape, name) 256 """ 257 return _constant_impl(value, dtype, shape, name, verify_shape=False, --> 258 allow_broadcast=True) 259 260

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\tensorflow_core\python\framework\constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast) 294 tensor_util.make_tensor_proto( 295 value, dtype=dtype, shape=shape, verify_shape=verify_shape, --> 296 allow_broadcast=allow_broadcast)) 297 dtype_value = attr_value_pb2.AttrValue(type=tensor_value.tensor.dtype) 298 const_tensor = g._create_op_internal( # pylint: disable=protected-access

D:\ProgramData\Anaconda3\envs\TF\lib\site-packages\tensorflow_core\python\framework\tensor_util.py in make_tensor_proto(values, dtype, shape, verify_shape, allow_broadcast) 437 else: 438 if values is None: --> 439 raise ValueError("None values not supported.") 440 # if dtype is provided, forces numpy array to be the type 441 # provided if possible.

ValueError: None values not supported.

zp946 avatar Apr 07 '20 09:04 zp946