Makes prediction based on a trained network. The index of the trained network is specified by parameters in the config file (in particular the variable 'snapshotindex'). The labels are stored as MultiIndex Pandas Array, which contains the name of the network, body part name, (x, y)
(
config: str,
videos: list[str],
video_extensions: str | Sequence[str] | None = None,
shuffle: int = 1,
trainingsetindex: int = 0,
gputouse: str | None = None,
save_as_csv: bool = False,
in_random_order: bool = True,
destfolder: str | None = None,
batch_size: int | None = None,
cropping: list[int] | None = None,
TFGPUinference: bool = True,
dynamic: tuple[bool, float, int] = (False, 0.5, 10),
modelprefix: str = "",
robust_nframes: bool = False,
allow_growth: bool = False,
use_shelve: bool = False,
auto_track: bool = True,
n_tracks: int | None = None,
animal_names: list[str] | None = None,
calibrate: bool = False,
identity_only: bool = False,
use_openvino: str | None = None,
engine: Engine | None = None,
**torch_kwargs,
)
| 672 | @renamed_parameter(old="batchsize", new="batch_size", since="3.0.0") |
| 673 | @renamed_parameter(old="videotype", new="video_extensions", since="3.0.0") |
| 674 | def analyze_videos( |
| 675 | config: str, |
| 676 | videos: list[str], |
| 677 | video_extensions: str | Sequence[str] | None = None, |
| 678 | shuffle: int = 1, |
| 679 | trainingsetindex: int = 0, |
| 680 | gputouse: str | None = None, |
| 681 | save_as_csv: bool = False, |
| 682 | in_random_order: bool = True, |
| 683 | destfolder: str | None = None, |
| 684 | batch_size: int | None = None, |
| 685 | cropping: list[int] | None = None, |
| 686 | TFGPUinference: bool = True, |
| 687 | dynamic: tuple[bool, float, int] = (False, 0.5, 10), |
| 688 | modelprefix: str = "", |
| 689 | robust_nframes: bool = False, |
| 690 | allow_growth: bool = False, |
| 691 | use_shelve: bool = False, |
| 692 | auto_track: bool = True, |
| 693 | n_tracks: int | None = None, |
| 694 | animal_names: list[str] | None = None, |
| 695 | calibrate: bool = False, |
| 696 | identity_only: bool = False, |
| 697 | use_openvino: str | None = None, |
| 698 | engine: Engine | None = None, |
| 699 | **torch_kwargs, |
| 700 | ): |
| 701 | """Makes prediction based on a trained network. |
| 702 | |
| 703 | The index of the trained network is specified by parameters in the config file |
| 704 | (in particular the variable 'snapshotindex'). |
| 705 | |
| 706 | The labels are stored as MultiIndex Pandas Array, which contains the name of |
| 707 | the network, body part name, (x, y) label position in pixels, and the |
| 708 | likelihood for each frame per body part. These arrays are stored in an |
| 709 | efficient Hierarchical Data Format (HDF) in the same directory where the video |
| 710 | is stored. However, if the flag save_as_csv is set to True, the data can also |
| 711 | be exported in comma-separated values format (.csv), which in turn can be |
| 712 | imported in many programs, such as MATLAB, R, Prism, etc. |
| 713 | |
| 714 | Parameters |
| 715 | ---------- |
| 716 | config: str |
| 717 | Full path of the config.yaml file. |
| 718 | |
| 719 | videos: list[str] |
| 720 | A list of strings containing the full paths to videos for analysis or a path to |
| 721 | the directory, where all the videos with same extension are stored. |
| 722 | |
| 723 | video_extensions : str | Sequence[str] | None, optional, default=None |
| 724 | Controls how ``videos`` are filtered, based on file extension. |
| 725 | File paths and directory contents are treated differently: |
| 726 | - ``None`` (default): file paths are accepted as-is; directories are |
| 727 | scanned for files with a recognized video extension. |
| 728 | - ``str`` or ``Sequence[str]`` (e.g. ``"mp4"`` or ``["mp4", "avi"]``): |
| 729 | both file paths and directory contents are filtered by the given |
| 730 | extension(s). |
| 731 |
no test coverage detected