Golbstein / Keras-segmentation-deeplab-v3.1

An awesome semantic segmentation model that runs in real time
175 stars 73 forks source link

Error running segmentation.ipynb #7

Closed swarmt closed 5 years ago

swarmt commented 5 years ago

OS: Ubuntu 16.04 ENV: Conda TF: 1.12.0 (GPU)

When running the notebook unmodified (except the PATH variable) I get the follow error.

`TypeErrorTraceback (most recent call last)

in () 7 8 model.compile(optimizer=Adam(lr=7e-4, epsilon=1e-8, decay=1e-6), sample_weight_mode="temporal", ----> 9 loss=losses, metrics=metrics) 10 print('Weights path:', SegClass.modelpath) /home/sam/miniconda3/envs/masknet/lib/python2.7/site-packages/keras/engine/training.pyc in compile(self, optimizer, loss, metrics, loss_weights, sample_weight_mode, weighted_metrics, target_tensors, **kwargs) 449 output_metrics = nested_metrics[i] 450 output_weighted_metrics = nested_weighted_metrics[i] --> 451 handle_metrics(output_metrics) 452 handle_metrics(output_weighted_metrics, weights=weights) 453 /home/sam/miniconda3/envs/masknet/lib/python2.7/site-packages/keras/engine/training.pyc in handle_metrics(metrics, weights) 418 metric_result = weighted_metric_fn(y_true, y_pred, 419 weights=weights, --> 420 mask=masks[i]) 421 422 # Append to self.metrics_names, self.metric_tensors, /home/sam/miniconda3/envs/masknet/lib/python2.7/site-packages/keras/engine/training_utils.pyc in weighted(y_true, y_pred, weights, mask) 402 """ 403 # score_array has ndim >= 2 --> 404 score_array = fn(y_true, y_pred) 405 if mask is not None: 406 # Cast the mask to floatX to avoid float64 upcasting in Theano /home/sam/Code/Keras-segmentation-deeplab-v3.1/utils.py in Jaccard(y_true, y_pred) 139 epochs = 20 140 batch_size = 16 --> 141 def __init__(self, dataset='VOCdevkit/VOC2012', image_size=(320,320)): 142 self.sz = image_size 143 self.mainpath = dataset /home/sam/miniconda3/envs/masknet/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.pyc in is_nan(x, name) 3930 if _ctx is None or not _ctx._eager_context.is_eager: 3931 _, _, _op = _op_def_lib._apply_op_helper( -> 3932 "IsNan", x=x, name=name) 3933 _result = _op.outputs[:] 3934 _inputs_flat = _op.inputs /home/sam/miniconda3/envs/masknet/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.pyc in _apply_op_helper(self, op_type_name, name, **keywords) 607 _SatisfiesTypeConstraint(base_type, 608 _Attr(op_def, input_arg.type_attr), --> 609 param_name=input_name) 610 attrs[input_arg.type_attr] = attr_value 611 inferred_from[input_arg.type_attr] = input_name /home/sam/miniconda3/envs/masknet/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.pyc in _SatisfiesTypeConstraint(dtype, attr_def, param_name) 58 "allowed values: %s" % 59 (param_name, dtypes.as_dtype(dtype).name, ---> 60 ", ".join(dtypes.as_dtype(x).name for x in allowed_list))) 61 62 TypeError: Value passed to parameter 'x' has DataType int32 not in list of allowed values: bfloat16, float16, float32, float64`
swarmt commented 5 years ago

Solved by creating a new conda env.