I'm trying to make a custom layer to make a Canny edges detection, but I can't convert the image tensor into a NumPy Array to send it to CV2.Canny()
'''
class canny(tf.keras.layers.Layer):
def __init__(self):
super(canny, self).__init__()
def call(self, img):
img = img.eval(session=tf.compat.v1.Session())
edg_img = cv2.Canny(img, 100, 200)
return tf.convert_to_tensor(edg_img)
'''
I get this error
'''File "", line 10, in call * img = img.eval(session=tf.compat.v1.Session())
InvalidArgumentError: Graph execution error:'''