Skip to content

Detailed Face Detection ​

Instance declaration ​

When you add a Detailed Face Detection block to the workspace, the following instance declaration is automatically inserted into the Python code:

python
detailed_face_detection = DetailedFaceDetection(0)
# When there are multiple instances
detailed_face_detection_1 = DetailedFaceDetection(1)

Parameters ​

NameKindDescriptionRange / TypeDefault
indexDropdown optionInstance number (starting from 0)Integer 0 or greater0

Select the camera device ​

Sets the camera to use for detailed face detection.

device

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionCamera device nameSystem camera label-

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.device('')

Load the model ​

Loads the trained face model. This step is required in order to use the features of the 'Detailed Face Detection' module.

load_model

Parameters ​

NameKindDescriptionRange / TypeDefault
waitCheckboxWhether to wait for loading to completeTRUE / FALSETRUE

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.load_model(wait=True)

Detect once ​

Finds the faces currently on screen and marks them just once.

detect_once

Parameters ​

(none)

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.detect_once()

Start / stop continuous detection ​

Keeps following the faces currently on screen and marks them on the screen.

detect_continuous

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionActionstart, stop-

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

# unit = "start"
detailed_face_detection.detect_continuous()
# unit = "stop"
detailed_face_detection.stop()

Show the detection result ​

Decides whether or not to show the face detection result on the camera screen.

display

Parameters ​

NameKindDescriptionRange / TypeDefault
onDropdown optionDisplay ON / OFFshow (on=True), hide (off=False)TRUE

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.display(True)
detailed_face_detection.display(False)

Coordinates of a face part ​

Returns the coordinates of each face part.

face_data

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionFace partface, left eye, right eye, mouth, nose, upper lip, lower lip, left lip, right lip, left pupil, right pupil-
posDropdown optionCoordinatex, y-

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.face('x')
detailed_face_detection.left_eye('y')
detailed_face_detection.upper_lip('x')
detailed_face_detection.right_pupil('y')

Face part rectangle information ​

Returns the position/size values of the rectangle around each face part region.

face_square

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionFace partface, left eye, right eye, mouth-
posDropdown optionRectangle informationmin x position (min_x), max x position (max_x), min y position (min_y), max y position (max_y), width, height, area-

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.face('min_x')
detailed_face_detection.left_eye('area')

Distance between two parts ​

Returns the distance between two face parts.

distance

Parameters ​

NameKindDescriptionRange / TypeDefault
unit1Dropdown optionFirst partA face part name-
unit2Dropdown optionSecond partA face part name-
typeDropdown optionKind of distancedistance (omitted or None), horizontal distance (horizontal), vertical distance (vertical)None

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.get_distance('left_eye', 'right_eye')  # distance
detailed_face_detection.get_distance('left_pupil', 'right_pupil', 'horizontal')  # horizontal distance
detailed_face_detection.get_distance('upper_lip', 'lower_lip', 'vertical')  # vertical distance

Model state ​

Returns the loading state of the face model.
It returns 0 if it has not been loaded yet, 1 while it is loading, and 2 once loading is complete.

model_state

Parameters ​

(none)

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.model_state()

Whether a face was detected ​

Whether a face was found

detected

Parameters ​

(none)

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.detected()