Append third-party annotations

Here we append annotations to already-featurized datasets as documented HERE

[1]:
from simba.third_party_label_appenders.third_party_appender import ThirdPartyLabelAppender
[2]:
# DEFINITIONS
# For details on the settings options, see the markdown tutorial - https://github.com/sgoldenlab/simba/blob/master/docs/third_party_annot_new.md

# Note: change the fole format to represent the data type of your annotations.
CONFIG_PATH = '/Users/simon/Desktop/envs/simba_dev/tests/data/test_projects/two_c57/project_folder/project_config.ini'
SETTINGS = {'log': True,
            'errors': {'INVALID annotations file data format': 'WARNING',
                       'ADDITIONAL third-party behavior detected': 'WARNING',
                       'Annotations EVENT COUNT conflict': 'WARNING',
                       'Annotations OVERLAP inaccuracy': 'WARNING',
                       'ZERO third-party video behavior annotations found': 'WARNING',
                       'Annotations and pose FRAME COUNT conflict': 'WARNING',
                       'Annotations data file NOT FOUND': 'WARNING'}}

[3]:
#ETHOVISION
DATA_DIR = '/Users/simon/Desktop/envs/simba_dev/tests/data/test_projects/two_c57/ethovision_annotations'
SETTINGS['file_format'] = 'xlsx'
test = ThirdPartyLabelAppender(config_path=CONFIG_PATH,
                               data_dir=DATA_DIR,
                               settings=SETTINGS,
                               app='ETHOVISION')
test.run()
Processing 1 ETHOVISION file(s)...
Reading in 1 ETHOVISION annotation files...
Reading ETHOVISION annotation file (1 / 1) ...
Processing annotations for Together_1 video...
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: Annotations file for video Together_1 has annotations for the following behaviors ['attacking', 'carry', 'groom', 'digging', 'aggressive groom', 'Sniff'] that are NOT classifiers named in the SimBA project. SimBA will OMIT appending the data for these 6 classifiers.         warning
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: No annotations detected for SimBA classifier(s) named ['Attack', 'Sniffing'] for video Together_1. All frame annotations will be set to behavior absent (0).       warning
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: No annotations detected for SimBA classifier(s) named ['Attack', 'Sniffing'] for video Together_1. All frame annotations will be set to behavior absent (0).       warning
Saved ETHOVISION annotations for video Together_1...
SIMBA COMPLETE: ETHOVISION annotations appended to dataset and saved in project_folder/csv/targets_inserted directory (elapsed time: 22.2962s)  complete
[4]:
#BORIS
DATA_DIR = '/Users/simon/Desktop/envs/simba_dev/tests/data/test_projects/two_c57/boris_annotations'
SETTINGS['file_format'] = 'csv'
_ = ThirdPartyLabelAppender(config_path=CONFIG_PATH,
                            data_dir=DATA_DIR,
                            settings=SETTINGS,
                            app='BORIS').run()
Processing 1 BORIS file(s)...
Reading in 1 BORIS annotation files...
Processing annotations for Together_1 video...
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: Annotations file for video Together_1 has annotations for the following behaviors ['walking', 'grooming', 'still outside nest', 'digging', 'still inside nest', 'nesting', 'drinking', 'undetermined'] that are NOT classifiers named in the SimBA project. SimBA will OMIT appending the data for these 8 classifiers.    warning
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: SimBA found THIRD-PARTY annotations for behavior Attack in video Together_1 that are annotated to occur at times which is not present in the video data you imported into SIMBA. The video you imported to SimBA has 1737 frames. However, in BORIS, you have annotated Attack to happen at frame number 1738. These ambiguous annotations occur in 144444 different frames for video Together_1 that SimBA will **remove** by default. Please make sure you imported the same video as you annotated in BORIS into SimBA and the video is registered with the correct frame rate. SimBA will only append annotations made to the frames present in the pose estimation data.      warning
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: No annotations detected for SimBA classifier(s) named ['Attack', 'Sniffing'] for video Together_1. All frame annotations will be set to behavior absent (0).       warning
Saved BORIS annotations for video Together_1...
SIMBA COMPLETE: BORIS annotations appended to dataset and saved in project_folder/csv/targets_inserted directory (elapsed time: 111.2231s)      complete
[5]:
#DEEPETHOGRAM
DATA_DIR = '/Users/simon/Desktop/envs/simba_dev/tests/data/test_projects/two_c57/deepethogram_annotations'
SETTINGS['file_format'] = 'csv'
_ = ThirdPartyLabelAppender(config_path=CONFIG_PATH,
                            data_dir=DATA_DIR,
                            settings=SETTINGS,
                            app='DEEPETHOGRAM').run()
Processing 1 DEEPETHOGRAM file(s)...
Reading in 1 DEEPETHOGRAM annotation files...
Processing annotations for Together_1 video...
Saved DEEPETHOGRAM annotations for video Together_1...
SIMBA COMPLETE: DEEPETHOGRAM annotations appended to dataset and saved in project_folder/csv/targets_inserted directory (elapsed time: 0.0969s)         complete
[6]:
#NOLDUS OBSERVER
DATA_DIR = '/Users/simon/Desktop/envs/simba_dev/tests/data/test_projects/two_c57/observer_annotations'
SETTINGS['file_format'] = 'xlsx'
_ = ThirdPartyLabelAppender(config_path=CONFIG_PATH,
                               data_dir=DATA_DIR,
                               settings=SETTINGS,
                               app='OBSERVER').run()
Processing 1 OBSERVER file(s)...
Reading in 1 OBSERVER annotation files...
Processing annotations for Together_1 video...
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: Annotations file for video Together_1 has annotations for the following behaviors ['following', 'anogenital Sniffing', 'grooming'] that are NOT classifiers named in the SimBA project. SimBA will OMIT appending the data for these 3 classifiers.        warning
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: SimBA found THIRD-PARTY annotations for behavior Attack in video Together_1 that are annotated to occur at times which is not present in the video data you imported into SIMBA. The video you imported to SimBA has 1737 frames. However, in BORIS, you have annotated Attack to happen at frame number 14336. These ambiguous annotations occur in 480 different frames for video Together_1 that SimBA will **remove** by default. Please make sure you imported the same video as you annotated in BORIS into SimBA and the video is registered with the correct frame rate. SimBA will only append annotations made to the frames present in the pose estimation data.        warning
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: The annotations for behavior Sniffing in video Together_1 contains 83 start events and 82 stop events. SimBA requires the number of stop and start event counts to be equal. SimBA will try to find and delete the odd event stamps.       warning
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: SimBA found THIRD-PARTY annotations for behavior Sniffing in video Together_1 that are annotated to occur at times which is not present in the video data you imported into SIMBA. The video you imported to SimBA has 1737 frames. However, in BORIS, you have annotated Sniffing to happen at frame number 1738. These ambiguous annotations occur in 10897 different frames for video Together_1 that SimBA will **remove** by default. Please make sure you imported the same video as you annotated in BORIS into SimBA and the video is registered with the correct frame rate. SimBA will only append annotations made to the frames present in the pose estimation data.   warning
Saved OBSERVER annotations for video Together_1...
SIMBA COMPLETE: OBSERVER annotations appended to dataset and saved in project_folder/csv/targets_inserted directory (elapsed time: 0.7935s)     complete
[7]:
#SOLOMON CODER
DATA_DIR = '/Users/simon/Desktop/envs/simba_dev/tests/data/test_projects/two_c57/solomon_annotations'
SETTINGS['file_format'] = 'csv'
_ = ThirdPartyLabelAppender(config_path=CONFIG_PATH,
                               data_dir=DATA_DIR,
                               settings=SETTINGS,
                               app='SOLOMON').run()
Processing 1 SOLOMON file(s)...
Reading in 1 SOLOMON annotation files...
Processing annotations for Together_1 video...
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: Annotations file for video Together_1 has annotations for the following behaviors ['Climbing', 'Rearing', 'Biting the grid', 'Stop', 'Retreat', 'Flight', 'Freezing', 'Grooming'] that are NOT classifiers named in the SimBA project. SimBA will OMIT appending the data for these 8 classifiers.         warning
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: SimBA found THIRD-PARTY annotations for behavior Attack in video Together_1 that are annotated to occur at times which is not present in the video data you imported into SIMBA. The video you imported to SimBA has 1737 frames. However, in BORIS, you have annotated Attack to happen at frame number 11072. These ambiguous annotations occur in 3579 different frames for video Together_1 that SimBA will **remove** by default. Please make sure you imported the same video as you annotated in BORIS into SimBA and the video is registered with the correct frame rate. SimBA will only append annotations made to the frames present in the pose estimation data.       warning
SIMBA WARNING: SIMBA THIRD-PARTY ANNOTATION WARNING: SimBA found THIRD-PARTY annotations for behavior Sniffing in video Together_1 that are annotated to occur at times which is not present in the video data you imported into SIMBA. The video you imported to SimBA has 1737 frames. However, in BORIS, you have annotated Sniffing to happen at frame number 8192. These ambiguous annotations occur in 3452 different frames for video Together_1 that SimBA will **remove** by default. Please make sure you imported the same video as you annotated in BORIS into SimBA and the video is registered with the correct frame rate. SimBA will only append annotations made to the frames present in the pose estimation data.    warning
Saved SOLOMON annotations for video Together_1...
SIMBA COMPLETE: SOLOMON annotations appended to dataset and saved in project_folder/csv/targets_inserted directory (elapsed time: 0.6953s)      complete
[ ]: