CMK Face Select:
CMKFaceSelect detects faces in an image and chooses one using an easy-to-understand rule, such as the largest face or the face nearest an edge or the center. This helps you identify the face you intend to work with when a scene contains more than one person. The node also prepares a visual diagnostic so you can check which face was chosen. It does not alter the image itself, and its selection is based on face detection rather than a person’s identity.
CMK Face Select Input Parameters:
image
The IMAGE to examine for faces. The node runs detection on the first image in the batch, so its face selection and diagnostic describe that first image even if you supply a batch. No default, minimum, or maximum is specified for this input.
detector_model
The face-detection model used to find faces before one is selected. The available dropdown choices come from models listed at runtime, so they depend on your installation; the supplied interface does not specify a fixed list or a default. Choose an available model suited to your workflow, and check the diagnostic to see whether it detects the faces you need.
detector_size
The size setting passed to the face detector. It affects the detection step and may change which faces are found, which in turn can change the selected face. The default is 640; the interface specifies a minimum of 128, a maximum of 1280, and a step of 64. The supplied code does not establish a guaranteed speed or accuracy difference between settings.
selection
The rule for choosing one face from those detected. Options are Largest, Leftmost, Rightmost, Topmost, Bottommost, and Center; the default is Largest. Use a directional choice when a face has a clear position in the composition, or Center when you want the centered face. If an unsupported selection value reaches the node, it falls back to Largest.
CMK Face Select Output Parameters:
image
The original IMAGE, returned unchanged. You can pass it onward while using the other outputs to identify the chosen face; this output is not the box-and-landmark preview shown in the diagnostic.
selected_face
A CMK_SELECTED_FACE record describing the chosen face. It includes the selection rule, detector settings, dimensions of the examined image, the image index, a selected index, and the detected face data. If no face is detected, its face data is empty and its selected index is -1. This is selection information, not a cropped or edited image.
diagnostic
A CMK_DIAGNOSTIC record for checking the result. When a face is selected, it includes a preview with the selected face marked, a summary and details, and metadata such as the number of detected faces and a Selected status. When none is found, it includes the unmarked preview, a No Detection status, a “no face detected” warning, and a face count of zero.
CMK Face Select Usage Tips:
- If you are working with a batch, remember that the node selects from the first image only. Feed it the intended image first when the face choice matters.
- Start with Largest for a prominent subject. For a group portrait, choose Leftmost, Rightmost, Topmost, Bottommost, or Center according to the subject’s position, then inspect the diagnostic preview to confirm the choice.
- If the diagnostic reports no detection, check that a face is visible in the first image and try another available detector model or detector size. The supplied source does not guarantee that any particular setting will find a face.
- Check the diagnostic’s face count as well as its marked preview. A count greater than one tells you the selection rule was applied among multiple detected faces; the marked preview shows which one was chosen.
CMK Face Select Common Errors and Solutions:
Status: No Detection; warning: no face detected
- Explanation: The detector found zero faces in the first image. The node still returns the original image and a selected_face record, but that record has an empty face and a selected index of -1. - Solution: Check that the intended face is visible in the first image. Try another detector model available in your dropdown or adjust detector_size, then inspect the diagnostic again.
image_index 0 out of range. Image batch size: 0
- Explanation: This is the source’s runtime error when the image batch contains no first image to examine.
- Solution: Connect an IMAGE containing at least one image and run the node again. The reported batch size in the message reflects what the node received.
An expected face was not selected
- Explanation: This is a result to check, not a specific error message from the supplied code. The node chooses from faces the detector found in the first image, according to the selected rule; it does not identify people by name.
- Solution: Inspect the marked diagnostic preview and face count. Choose a positional rule that fits the intended face, or try a different available detector model or detector_size if the expected face was not detected.
A downstream node cannot use the empty selected_face
- Explanation: This is a possible downstream issue, not an error message established for CMKFaceSelect. After No Detection, selected_face contains no face data for another node to process.
- Solution: Resolve the No Detection result before relying on selected_face in later steps. Confirm that the diagnostic shows Selected and marks the intended face.
