Documentation for PyPortal.Job
Module for Cloud Portal jobs.
Job
Job(
project_id: str,
actor_name: str,
tracking_model: TrackingModel,
video_file_path: Optional[str] = None,
calibration_image_file_path: Optional[str] = None,
video_rotation: Optional[
VideoRotation
] = VideoRotation.NONE,
tracking_version: Optional[str] = None,
)
A class encapsulating submitable and retriable Cloud Portal Job.
Intended to be initilized via the project, not directly.
To submit for processing use Project.submit_job()
method.
Warning
The status
, progress
, processing_seconds
and extended_status
properties are not updated in real-time and added only for filtering purposes when the jobs are loaded via project get_job
and get_jobs
methods.
For the latest status and progress changes use the following methods:
- get_status(), it will also update .status and .extended_status property; returns last status only
- get_progress(), it will also update .progress property; returns last progress in percentage
Initialize Job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id |
str
|
Identifier for the project within the organization. |
required |
actor_name |
str
|
Name of the actor. |
required |
tracking_model |
TrackingModel
|
The model to be used for video tracking. |
required |
video_file_path |
Optional[str]
|
Path to the video file to be processed. |
None
|
calibration_image_file_path |
Optional[str]
|
Optional path to calibration image. |
None
|
video_rotation |
Optional[VideoRotation]
|
Specifies the rotaation. Default is 'NONE'. |
NONE
|
tracking_version |
Optional[str]
|
Optional tracking version. Default is 'None'. |
None
|
progress
property
Returns job progress if any.
Will be None if the job was not submitted yet.
status
property
Returns job status.
Will return JobStatus.NOT_SUBMITTED if the job was not submitted yet.
delete
async
Will delete the job if the job status is either completed (successfully or failed) or in queue.
Returns:
Type | Description |
---|---|
bool
|
True if the job deletion was successful. False, otherwise |
Raises:
Type | Description |
---|---|
PortalHTTPException
|
If there was an error while communicating with Faceware Portal. |
download_analyzer_file
async
Will download the Faceware Analyzer.
Visit: https://facewaretech.com/software/analyzer/ for more information on Analyzer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
absolute_file_name |
str
|
The location on the local filesystem where Analyzer file will be downloaded. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if download was successful. False otherwise. |
Raises:
Type | Description |
---|---|
PortalHTTPException
|
If there was an error while communicating with Faceware Portal. |
DownloadError
|
If there was an error while downloading with Faceware Portal. |
FileNotFoundError
|
If the parent directory path to the absolute_file_name does not exists on filesystem. |
download_control_data
async
Will download the Faceware Portal Controls JSON file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
absolute_file_name |
str
|
The location on the local filesystem where JSON file will be downloaded. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if download was successful. False otherwise. |
Raises:
Type | Description |
---|---|
PortalHTTPException
|
If there was an error while communicating with Faceware Portal. |
DownloadError
|
If there was an error while downloading with Faceware Portal. |
FileNotFoundError
|
If the parent directory path to the absolute_file_name does not exists on filesystem. |
download_retargeting_file
async
Will download the Faceware Retargeter.
Visit: https://facewaretech.com/software/retargeter/ for more information on Retargeter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
absolute_file_name |
str
|
The location on the local filesystem where retargeting file will be downloaded. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if download was successful. False otherwise. |
Raises:
Type | Description |
---|---|
PortalHTTPException
|
If there was an error while communicating with Faceware Portal. |
DownloadError
|
If there was an error while downloading with Faceware Portal. |
FileNotFoundError
|
If the parent directory path to the absolute_file_name does not exists on filesystem. |
download_validaton_video
async
Will download the Faceware Portal tracking quality validation video file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
absolute_file_name |
str
|
The location on the local filesystem where JSON file will be downloaded. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if download was successful. False otherwise. |
Raises:
Type | Description |
---|---|
PortalHTTPException
|
If there was an error while communicating with Faceware Portal. |
DownloadError
|
If there was an error while downloading with Faceware Portal. |
FileNotFoundError
|
If the parent directory path to the absolute_file_name does not exists on filesystem. |
get_progress
async
Get current progress.
Raises:
Type | Description |
---|---|
PortalHTTPException
|
If there was an error while communicating with Faceware Portal. |
Returns:
Type | Description |
---|---|
Optional[int]
|
A progress (int) for submitted or completed jobs. None otherwise. |
get_status
async
get_status() -> JobStatus
Get current status. Running get_status() will also update .status and .extended_status (if any) properties
Raises:
Type | Description |
---|---|
PortalHTTPException
|
If there was an error while communicating with Faceware Portal. |
Returns:
Type | Description |
---|---|
JobStatus
|
JobStatus. |
TrackingModel
Tracking models.
HEAD_CAM
class-attribute
instance-attribute
The HEAD_CAM tracker is designed to be used specifically with color videos from a head mounted camera. To work properly, the video must be in a vertical orientation (more tall than wide) and the face should be occupying the vast majority of the frame like in the example below.
Tip
Due to the stringent requirements for this tracker, if you are getting errors or an inconsistent track with either Headcam tracker, try using the STATIC_CAM instead to improve your chances of getting a good result
HEAD_CAM_GRAYSCALE
class-attribute
instance-attribute
This tracker is almost identical to the HEAD_CAM tracker except for being specifically made for greyscale (black and white) videos and should only be used for that type of footage.
Warning
This tracking model is currently in an experimental evaluation phase.
STATIC_CAM
class-attribute
instance-attribute
The STATIC_CAM tracker is designed for use with stationary cameras. The actor's face can take up a varying amount of the total frame and can move around. Due to its flexibility as a tracker, it can be used with virtually any facial footage.
VideoRotation
Rotation angle to be applied while processing the video.
This is useful when video that needs processing was captured in non-standard orientation