Face Track CHOP

From Derivative
Jump to navigation Jump to search


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 Nvidia Broadcast Engine and requires Windows and an Nvidia RTX card to operate.

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:

  • sfm_shape_3448.bin
  • expression_blendshapes_3448.bin
  • sfm_3448_edge_topology.json
  • sfm_model_contours.json
  • ibug_to_sfm.txt

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.

ConvertSurreyFaceModel.exe --shape=path/sfm_shape_3448.bin --blend_shape=path/expression_blendshapes_3448.bin --topology=path/sfm_3448_edge_topology.json --contours=path/sfm_model_contours.json --ibug=path/ibug_to_sfm.txt --out=output-path/face_model0.nvf


Parameters - FaceTrack Page

Active active - Enables the face tracking features.

Model Folder modelfolder - The location of the AI model files used for face detection. By default these files are located in the Config/Models folder.

Mesh File 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 Device gpu - - The GPU to run the face tracking models on. An Nvidia RTX or newer card is required.

  • Default default - The driver will select the most appropriate GPU in the system.

TOP top - A path to the TOP operator that will provides the image to perform face tracking on.

Bounding Boxes 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 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 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.
  • 126 num126 - An extended set of landmark features.

Landmark Confidence landmarkconfidence - Adds a confidence value for each landmark feature. Higher values indicate the feature is more likely to be accurate.

Mesh Transform 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

Time Slice 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 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.

Export Method 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 geo1/transform1:tx.

Export Root autoexportroot - This path points to the root node where all of the paths that exporting by Channel Name is Path:Parameter are relative to.

Export Table exporttable - The DAT used to hold the export information when using the DAT Table Export Methods (See above).

Ableton Link • Analyze • Angle • Attribute • Audio Band EQ • Audio Device In • Audio Device Out • Audio Dynamics • Audio File In • Audio File Out • Audio Filter • Audio Movie • Audio NDI • Audio Oscillator • Audio Para EQ • Audio Play • Audio Render • Audio Spectrum • Audio Stream In • Audio Stream Out • Beat • Bind • BlackTrax • Blend • Blob Track • Bullet Solver • Clip Blender • Clip • Clock • Composite • Constant • Copy • Count • CPlusPlus • Cross • Cycle • DAT to • Delay • Delete • DMX In • DMX Out • Envelope • EtherDream • Event • Expression • Extend • Experimental:Face Track • Fan • Feedback • File In • File Out • Filter • FreeD • Function • Gesture • Handle • Helios DAC • Hog • Hokuyo • Hold • Import Select • In • Info • Interpolate • Introduction To CHOPs id • Inverse Curve • Inverse Kin • Join • Joystick • Keyboard In • Keyframe • Kinect Azure • Kinect • Lag • Laser • Leap Motion • Leuze ROD4 • LFO • Limit • Logic • Lookup • LTC In • LTC Out • Math • Merge • MIDI In • MIDI In Map • MIDI Out • Mouse In • Mouse Out • NatNet In • Ncam • Noise • Null • Object • Oculus Audio • Oculus Rift • OpenVR • OSC In • OSC Out • Out • Override • Panel • Pangolin • Parameter • Pattern • Perform • Phaser • Pipe In • Pipe Out • PosiStageNet • Pulse • RealSense • Record • Rename • Render Pick • Reorder • Replace • Resample • S Curve • Scan • Script • Select • Sequencer • Serial • Shared Mem In • Shared Mem Out • Shift • Shuffle • Slope • SOP to • Sort • Speed • Splice • Spring • Stretch • Stype • Switch • Sync In • Sync Out • Tablet • Time Slice • Timeline • Timer • TOP to • Touch In • Touch Out • Trail • Transform • Transform XYZ • Trigger • Trim • Warp • Wave • WrnchAI • ZED