Open
Description
I'm taking a batch of 8 images directly off the "KSampler SDXL Efficient" node and trying to extract the number of faces and count them. It's throwing this error:
!!! Exception during processing !!! A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces `keras.layers` and `keras.operations`). You are likely doing something like:
x = Input(...)
tf_fn(x) # Invalid.
What you should do instead is wrap `tf_fn` in a layer:
class MyLayer(Layer):
def call(self, x):
return tf_fn(x)
x = MyLayer()(x)
Traceback (most recent call last):
File "/ai/ComfyUI/execution.py", line 323, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ai/ComfyUI/execution.py", line 198, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ai/ComfyUI/execution.py", line 169, in _map_node_over_list
process_inputs(input_dict, i)
File "/ai/ComfyUI/execution.py", line 158, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ai/ComfyUI/custom_nodes/ComfyUI-Deepface/nodes.py", line 72, in run
detected_faces = DeepFace.extract_faces(
^^^^^^^^^^^^^^^^^^^^^^^
File "/ai/ve/comfy/lib/python3.12/site-packages/deepface/DeepFace.py", line 484, in extract_faces
return detection.extract_faces(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/ai/ve/comfy/lib/python3.12/site-packages/deepface/modules/detection.py", line 89, in extract_faces
face_objs = DetectorWrapper.detect_faces(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ai/ve/comfy/lib/python3.12/site-packages/deepface/detectors/DetectorWrapper.py", line 83, in detect_faces
face_detector: Detector = build_model(detector_backend)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ai/ve/comfy/lib/python3.12/site-packages/deepface/detectors/DetectorWrapper.py", line 51, in build_model
face_detector = face_detector()
^^^^^^^^^^^^^^^
File "/ai/ve/comfy/lib/python3.12/site-packages/deepface/detectors/RetinaFace.py", line 9, in __init__
self.model = rf.build_model()
^^^^^^^^^^^^^^^^
File "/ai/ve/comfy/lib/python3.12/site-packages/retinaface/RetinaFace.py", line 54, in build_model
retinaface_model.build_model(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ai/ve/comfy/lib/python3.12/site-packages/retinaface/model/retinaface_model.py", line 1027, in build_model
x1_shape = tf.shape(ssh_c3_up)
^^^^^^^^^^^^^^^^^^^
File "/ai/ve/comfy/lib/python3.12/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/ai/ve/comfy/lib/python3.12/site-packages/keras/src/backend/common/keras_tensor.py", line 138, in __tf_tensor__
raise ValueError(
ValueError: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces `keras.layers` and `keras.operations`). You are likely doing something like:
x = Input(...)
tf_fn(x) # Invalid.
What you should do instead is wrap `tf_fn` in a layer:
class MyLayer(Layer):
def call(self, x):
return tf_fn(x)
x = MyLayer()(x)
Prompt executed in 101.88 seconds
Metadata
Metadata
Assignees
Labels
No labels