Face Track CHOP
The Face Track CHOP can detect faces and facial landmark points in an image, as well as the direction the face is looking relative to the camera. Using a compatible 3D Morphable Face Model (3DMM) and the Face Track SOP, it can also be used to fit and animate a 3D mesh to the detected face. Note: This operator uses the Augmented Reality (AR) SDK of the Nvidia Maxine system and requires Windows and a 20 or 30 series Nvidia RTX card to operate. 40 series cards are not currently supported.
The input image is taken from a provided TOP and can be of any resolution or format, and either a still image or video. If multiple faces are present in an image, the CHOP will attempt to track the largest one detected.
The coordinates of the detected features are given in u, v positions relative to the bottom-left corner of the input image. By default, the values range from 0 to 1, but the 'Aspect Correct' parameter can be enabled to scale the values so that they can be used as 3D coordinates while maintaining the aspect ratio of the original image.
To align a 3D rendering of the points with the original input image, set the 'Projection' of your Camera COMP to 'Orthographic', the 'Ortho Origin' parameter to 'Bottom-Left', and the 'Ortho Width' to 1, while also enabling 'Aspect Correct' on the Face Track CHOP.
To use the mesh fitting features you will need a compatible face mesh file in the Nvidia 'nvf' format. This file is not included with TouchDesigner, but can be generated using files available online.
To create the file:
1. Download the Surrey Face Model files from the eos project on GitHub:
2. Download the mesh conversion tool ConvertSurreyFaceModel.exe from the Nvidia AR SDK page on GitHub
3. Run the conversion tool to generate the nvf file. The 'path' is only necessary if the model files are in a different folder than the conversion tool.
Parameters - FaceTrack Page
active - Enables the face tracking features.
modelfolder - The location of the AI model files used for face detection. By default these files are located in the Config/Models folder.
meshfile - The 3D morphable mesh file in Nvidia 'nvf' format to use in mesh fitting. See above for instructions on how to create a compatible file. When available, the fitted mesh can be accessed with a Face Track SOP.
gpu - ⊞ - The GPU to run the face tracking models on. An Nvidia RTX or newer card is required.
default- The driver will select the most appropriate GPU in the system.
top - A path to the TOP operator that will provides the image to perform face tracking on.
bbox - Output channels that describe a bounding box around the detected face. The channels give the u and v positions of the center of the face as well as the width and height of the box. The positions are relative to the bottom-left corner of the input image.
Bounding Box Confidence
bboxconfidence - Outputs a channel that describes the level of certainty that the AI model has detected a face in the input image. Higher numbers indicate greater confidence.
rotations - Output rx, ry, and rz values that indicate how the face is oriented in the image. (0,0,0) indicates that the face is oriented directly towards the camera. Values can range from +/- 180 degrees as the subject turns away from the camera.
Number of Landmarks
landmarks - ⊞ -
none- The number of facial landmark points to output. Points are numbered beginning from 1 and always represent a fixed feature on the face such as the chin, eyebrow, nose, etc. Positions are given as u and v coordinates relative to the bottom-left corner of the input image.
- 68 (Multi-PIE Mark-ups)
num68- A standard set of facial landmark features used in AI research. See Reference Diagram.
num126- An extended set of landmark features.
landmarkconfidence - Adds a confidence value for each landmark feature. Higher values indicate the feature is more likely to be accurate.
meshtransform - Enable to output translate, rotate and scale channels for the fitted face mesh. This feature requires a valid 3D morphable face mesh file (see notes above). The values from these channels can be used to transform the mesh produced by an attached Face Track SOP so that it aligns with the input image. By default the fitted mesh is pre-transformed to align with the image, but if 'Pre-Transform' is disabled in the SOP, these values can be used instead for more control and speed.
Aspect Correct UVs
aspectcorrectuv - Rescales the the u and v positions so that they have the correct aspect ratio of the input image. This is useful when using the u, v positions as 3D coordinates rather than as image positions.
Parameters - Common Page
timeslice - Turning this on forces the channels to be "Time Sliced". A Time Slice is the time between the last cook frame and the current cook frame.
scope - To determine which channels get affected, some CHOPs use a Scope string on the Common page.
Sample Rate Match
srselect - ⊞ - Handle cases where multiple input CHOPs' sample rates are different. When Resampling occurs, the curves are interpolated according to the Interpolation Method Option, or "Linear" if the Interpolate Options are not available.
- Resample At First Input's Rate
first- Use rate of first input to resample others.
- Resample At Maximum Rate
max- Resample to the highest sample rate.
- Resample At Minimum Rate
min- Resample to the lowest sample rate.
- Error If Rates Differ
err- Doesn't accept conflicting sample rates.
exportmethod - ⊞ - This will determine how to connect the CHOP channel to the parameter. Refer to the Export article for more information.
- DAT Table by Index
datindex- Uses the docked DAT table and references the channel via the index of the channel in the CHOP.
- DAT Table by Name
datname- Uses the docked DAT table and references the channel via the name of the channel in the CHOP.
- Channel Name is Path:Parameter
autoname- The channel is the full destination of where to export to, such has
autoexportroot - This path points to the root node where all of the paths that exporting by Channel Name is Path:Parameter are relative to.
exporttable - The DAT used to hold the export information when using the DAT Table Export Methods (See above).
Info CHOP Channels
Extra Information for the Face Track CHOP can be accessed via an Info CHOP.
Common CHOP Info Channels
- start - Start of the CHOP interval in samples.
- length - Number of samples in the CHOP.
- sample_rate - The samplerate of the channels in frames per second.
- num_channels - Number of channels in the CHOP.
- time_slice - 1 if CHOP is Time Slice enabled, 0 otherwise.
- export_sernum - A count of how often the export connections have been updated.
Common Operator Info Channels
- total_cooks - Number of times the operator has cooked since the process started.
- cook_time - Duration of the last cook in milliseconds.
- cook_frame - Frame number when this operator was last cooked relative to the component timeline.
- cook_abs_frame - Frame number when this operator was last cooked relative to the absolute time.
- cook_start_time - Time in milliseconds at which the operator started cooking in the frame it was cooked.
- cook_end_time - Time in milliseconds at which the operator finished cooking in the frame it was cooked.
- cooked_this_frame - 1 if operator was cooked this frame.
- warnings - Number of warnings in this operator if any.
- errors - Number of errors in this operator if any.