Congruence analysis

class expert.core.congruence.congruence_analysis.CongruenceDetector(video_path: str | PathLike, features_path: str | PathLike, face_image: str | PathLike, transcription_path: str | PathLike, diarization_path: str | PathLike, lang: str = 'en', duration: int = 10, sr: int = 44100, device: torch.device | None = None, output_dir: str | PathLike | None = None)[source]

Bases: object

Determination of expert emotions congruence.

Parameters
  • video_path (str | PathLike) – Path to local video file.

  • features_path (str | PathLike) – Path to JSON file with information about detected faces.

  • face_image (str | PathLike) – Path to face image selected by user.

  • transcription_path (str | PathLike) – Path to JSON file with text transcription.

  • diarization_path (str | PathLike) – Path to JSON file with diarization information.

  • lang (str, optional) – Speech language for text processing [‘ru’, ‘en’]. Defaults to ‘en’.

  • duration (int, optional) – Length of intervals for extracting features. Defaults to 10.

  • sr (int, optional) – Sample rate. Defaults to 16000.

  • device (torch.device | None, optional) – Device type on local machine (GPU recommended). Defaults to None.

  • output_dir (str | Pathlike | None, optional) – Path to the folder for saving results. Defaults to None.

Returns

Paths to the emotion and congruence reports.

Return type

Tuple[str, str]

Raises

NotImplementedError – If ‘lang’ is not equal to ‘en’ or ‘ru’.

Example

>>> import torch
>>> cong_detector = CongruenceDetector(
        video_path="test_video.mp4",
        features_path="temp/test_video/features.json",
        face_image="temp/test_video/faces/0.jpg",
        transcription_path="temp/test_video/transcription.json",
        diarization_path="temp/test_video/diarization.json",
        device=torch.device("cuda:0"),
    )
>>> cong_detector.get_congruence()
("temp/test_video/emotions.json", "temp/test_video/congruence.json")
property device: torch.device

Check the device type.

Returns

Device type on local machine.

Return type

torch.device