C4 W3 A1 TypeError: Cannot convert 0.5 to EagerTensor of dtype int64

I checked the other solutions provided by the search. but i wasnt able to find any good answers

i used all the necessary functions and correct arguments,

TypeError                                 Traceback (most recent call last)
<ipython-input-31-2cab1199ef30> in <module>
      4 boxes = tf.random.normal([19, 19, 5, 4], mean=1, stddev=4, seed = 1)
      5 box_class_probs = tf.random.normal([19, 19, 5, 80], mean=1, stddev=4, seed = 1)
----> 6 scores, boxes, classes = yolo_filter_boxes(boxes, box_confidence, box_class_probs, threshold = 0.5)
      7 print("scores[2] = " + str(scores[2].numpy()))
      8 print("boxes[2] = " + str(boxes[2].numpy()))

<ipython-input-30-81a7caa549ec> in yolo_filter_boxes(boxes, box_confidence, box_class_probs, threshold)
     40 #     print("threshold type",type(threshold))
     41 #     box_class_scores_float=tf.cast(box_class_scores, dtype=tf.float32)
---> 42     filtering_mask = ( box_class_scores >= threshold )
     43 
     44 

/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/gen_math_ops.py in greater_equal(x, y, name)
   4053       _result = pywrap_tfe.TFE_Py_FastPathExecute(
   4054         _ctx._context_handle, tld.device_name, "GreaterEqual", name,
-> 4055         tld.op_callbacks, x, y)
   4056       return _result
   4057     except _core._NotOkStatusException as e:

TypeError: Cannot convert 0.5 to EagerTensor of dtype int64

  • even though i am getting this error

@saifkhanengr can you please help on this?

Check how you are calculating box_class_scores. And, it depends on box_scores, so, check that too. Don’t forget to set axis to -1.

I have done the same though

You sent me your code in which you didn’t set the axis to -1.

I have the same problem