Labelling

Extracting labelled images

class simba.labelling.extract_labelled_frames.AnnotationFrameExtractor(clfs: List[str], settings: Dict[str, int], config_path: str)[source]

Bases: ConfigReader

Extracts all human annotated frames where behavior is annotated as present into .pngs within a SimBA project.

Parameters
  • clfs (list) – Names of classifiers to extract behavior-present images from.

  • settings (dict) – User-defined settings. E.g., how much to downsample the png images.

  • config_path (str) – path to SimBA configparser.ConfigParser project_config.in

Note

Use settings={‘downsample’: 2} to downsample all .pngs to 0.5 original size for disk space savings.

Example

>>> extractor = AnnotationFrameExtractor(config_path='project_folder/project_config.ini', clfs=['Sniffing', 'Attack'], settings={'downsample': 2})
>>> extractor.run()

SimBA advanced GUI labelling interface

class simba.labelling.labelling_advanced_interface.AdvancedLabellingInterface(config_path: str, file_path: str, continuing: bool)[source]

Bases: ConfigReader

Launch advanced labelling (annotation) interface in SimBA.

_images/adv_annotator.png
Parameters
  • config_path (str) – path to SimBA project config file in Configparser format

  • file_path (str) – Path to video that is to be annotated

  • continuing (bool) – If True, user is continuing the annotations of a video with started but incomplete annotations.

Examples

>>> select_labelling_video_advanced(config_path='MyProjectConfig', file_path='MyVideoFilePath', continuing=True)

SimBA GUI labelling interface

class simba.labelling.labelling_interface.LabellingInterface(config_path: str, file_path: str, threshold_dict: Optional[Dict[str, float]] = None, setting: typing_extensions.Literal['from_scratch', 'pseudo'] = 'pseudo', continuing: bool = False)[source]

Bases: ConfigReader

Launch standard or pseudo-labelling (annotation) GUI interface in SimBA.

_images/annotator.png
Parameters
  • config_path (str) – path to SimBA project config file in Configparser format

  • file_path (str) – Path to video that is to be annotated

  • setting (str) – String representing annotation method. OPTIONS: from_scratch or pseudo

  • threshold_dict (dict) – If setting pseudo, threshold_dict dict contains the machine probability thresholds, with the classifier names as keys and the classification probabilities as values, e.g. {‘Attack’: 0.40, ‘Sniffing’: 0.7).

  • continuing (bool) – If True, continouing previously started annotation session.

Examples

>>> select_labelling_video(config_path='MyConfigPath', threshold_dict={'Attack': 0.4}, file_path='MyVideoFilePath', setting='pseudo', continuing=False)

Playing videos in the annotation interface

simba.labelling.play_annotation_video.annotation_video_player()[source]

Private methods for playing the video that is being annotated in SimBA GUI