idtrackerai

Video information manager

Collects information concerning the video (fps, number of channels, …) and manages the creation of the folders used to save and load both partial and final outputs of the algorithm

class video.Video(video_path=None)[source]

Attributes

video_path (str) path to the video (if the video is split in portions, the path to one of the portions)
number_of_animals (int) number of animals to track
episodes_start_end (list) list of lists of the form [start, end] to parallelise processes
original_bkg (ndarray) model of the background with size the frame size
bkg (ndarray) resized bkg according to Video.resolution_reduction
subtract_bkg (bool) True if bkg subtraction is performed
original_ROI (ndarray) ROI of the size of frame
ROI (ndarray) resized ROI according to Video.resolution_reduction
apply_ROI (bool) True if a non-trivial ROI has been specified
min_threshold (int) minimum intensity threshold
max_threshold (int) maximum intensity threshold
min_area (int) minimum blob area
max_area (int) maximum blob area
resegmentation_parameters (list) segmentation parameters specific to a frame
has_preprocessing_parameters (bool) True if the preprocessing has been concluded succesfully
maximum_number_of_blobs (int) Maximum number of blobs segmented from a single frame
resolution_reduction (float) resolution reduction to be applied to the original frame
erosion_kernel_size (int) size of the kernel used to erode blobs while solving the crossings. See assign_them_all

Methods

check_paths_consistency_with_video_path(…)
check_split_video() If the video is divided in segments retrieves their paths
compute_identification_image_size(…) Uses an estimate of the body length of the animals in order to compute the size of the square image that is generated from every blob to identify the animals
compute_overall_P2(fragments)
copy_attributes_between_two_video_objects(…)
create_accumulation_folder([…]) Folder in which the model generated while accumulating is stored (after pretraining)
create_crossings_detector_folder() If it does not exist creates a folder called crossing_detector in the video folder
create_embeddings_folder() If it does not exist creates a folder called embedding in the video folder
create_preprocessing_folder() If it does not exist creates a folder called preprocessing in the video folder
create_pretraining_folder([delete]) Creates a folder named pretraining in video_folder where the model trained during the pretraining is stored
create_session_folder([name]) Creates a folder named training in video_folder and a folder session_num where num is the session number and it is created everytime one starts training a network for a certain video_path
create_training_folder() Folder in which the last model is stored (after accumulation)
create_trajectories_folder() Folder in which trajectories files are stored
create_trajectories_wo_gaps_folder() Folder in which trajectories files are stored
get_episodes() Split video in episodes (chunks) of 500 frames for parallelisation
get_info() Retrieves basic information concerning the video.
in_which_episode(frame_number) Check to which episode a frame index belongs
init_accumulation_statistics_attributes([…])
init_processes_time_attributes()
is_identity_transfer_possible()
rename_session_folder(new_session_name)
save() save class
store_accumulation_statistics_data(…[, …])
store_accumulation_step_statistics_data(…)
update_paths(new_video_object_path)
update_tensorflow_checkpoints_file(…)
blobs_path

get the path to save the blob collection after segmentation. It checks that the segmentation has been succesfully performed

blobs_path_segmented

get the path to save the blob collection after segmentation. It checks that the segmentation has been succesfully performed

check_split_video()[source]

If the video is divided in segments retrieves their paths

compute_identification_image_size(maximum_body_length)[source]

Uses an estimate of the body length of the animals in order to compute the size of the square image that is generated from every blob to identify the animals

create_accumulation_folder(iteration_number=0, delete=False)[source]

Folder in which the model generated while accumulating is stored (after pretraining)

create_crossings_detector_folder()[source]

If it does not exist creates a folder called crossing_detector in the video folder

create_embeddings_folder()[source]

If it does not exist creates a folder called embedding in the video folder

create_preprocessing_folder()[source]

If it does not exist creates a folder called preprocessing in the video folder

create_pretraining_folder(delete=False)[source]

Creates a folder named pretraining in video_folder where the model trained during the pretraining is stored

create_session_folder(name='')[source]

Creates a folder named training in video_folder and a folder session_num where num is the session number and it is created everytime one starts training a network for a certain video_path

create_training_folder()[source]

Folder in which the last model is stored (after accumulation)

create_trajectories_folder()[source]

Folder in which trajectories files are stored

create_trajectories_wo_gaps_folder()[source]

Folder in which trajectories files are stored

fragments_path

get the path to save the list of global fragments after fragmentation

get_episodes()[source]

Split video in episodes (chunks) of 500 frames for parallelisation

get_info()[source]

Retrieves basic information concerning the video. If the video is recorded as a single file, it generates “episodes” for parallelisation during segmentation

global_fragments_path

get the path to save the list of global fragments after fragmentation

in_which_episode(frame_number)[source]

Check to which episode a frame index belongs

save()[source]

save class

tracking_interval

Tuple with the starting and ending frame on which the tracking will be performed.