deepof.utils.automatically_recognize_arena
- deepof.utils.automatically_recognize_arena(coordinates: deepof_coordinates, tables: deepof_table_dict, videos: list, vid_index: int, path: str = '.', arena_type: str = 'circular-autodetect', arena_reference: list | None = None, segmentation_model: Module | None = None, debug: bool = False) Tuple[array, int, int]
Return numpy.ndarray with information about the arena recognised from the first frames of the video.
WARNING: estimates won’t be reliable if the camera moves along the video.
- Parameters:
coordinates (coordinates) – Coordinates object.
tables (table_dict) – Dictionary of tables per experiment.
videos (list) – Relative paths of the videos to analise.
vid_index (int) – Element of videos list to use.
path (str) – Full path of the directory where the videos are.
conditions. (potentially more accurate in poor lighting)
arena_type (string) – Arena type; must be one of [‘circular-autodetect’, ‘circular-manual’, ‘polygon-manual’].
arena_reference (list) – List of coordinates defining the reference arena annotated by the user.
segmentation_model (torch.nn.Module) – Model used for automatic arena detection.
debug (bool) – If True, save a video frame with the arena detected.
- Returns:
1D-array containing information about the arena. If the arena is circular, returns a 3-element-array) -> center, radius, and angle. If arena is polygonal, returns a list with x-y position of each of the n the vertices of the polygon. h (int): Height of the video in pixels. w (int): Width of the video in pixels.
- Return type:
arena (np.ndarray)