MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / analyze_images

Function analyze_images

deeplabcut/compat.py:1139–1312  ·  view source on GitHub ↗

Analyzes images with a DeepLabCut model and stores the output in an H5 file. This method is only implemented for PyTorch models. The labels are stored as Pandas DataFrame, which contains the name of the network, body part name, (x, y) label position in pixels, and the likelihood for ea

(
    config: str | Path,
    images: str | Path | list[str] | list[Path],
    frame_type: str | None = None,
    destfolder: str | Path | None = None,
    shuffle: int = 1,
    trainingsetindex: int = 0,
    max_individuals: int | None = None,
    device: str | None = None,
    snapshot_index: int | None = None,
    detector_snapshot_index: int | None = None,
    save_as_csv: bool = False,
    modelprefix: str = "",
    plotting: bool | str = False,
    pcutoff: float | None = None,
    bbox_pcutoff: float | None = None,
    plot_skeleton: bool = False,
    **torch_kwargs,
)

Source from the content-addressed store, hash-verified

1137
1138
1139def analyze_images(
1140 config: str | Path,
1141 images: str | Path | list[str] | list[Path],
1142 frame_type: str | None = None,
1143 destfolder: str | Path | None = None,
1144 shuffle: int = 1,
1145 trainingsetindex: int = 0,
1146 max_individuals: int | None = None,
1147 device: str | None = None,
1148 snapshot_index: int | None = None,
1149 detector_snapshot_index: int | None = None,
1150 save_as_csv: bool = False,
1151 modelprefix: str = "",
1152 plotting: bool | str = False,
1153 pcutoff: float | None = None,
1154 bbox_pcutoff: float | None = None,
1155 plot_skeleton: bool = False,
1156 **torch_kwargs,
1157) -> dict[str, dict[str, np.ndarray | np.ndarray]]:
1158 """Analyzes images with a DeepLabCut model and stores the output in an H5 file.
1159
1160 This method is only implemented for PyTorch models.
1161
1162 The labels are stored as Pandas DataFrame, which contains the name of the network,
1163 body part name, (x, y) label position in pixels, and the likelihood for each frame
1164 per body part.
1165
1166 Parameters
1167 ----------
1168 config : str, Path
1169 Full path of the project's config.yaml file.
1170
1171 images: str, Path, list[str], list[Path]
1172 The image(s) to run inference on. Can be the path to an image, the path
1173 to a directory containing images, or a list of image paths or directories
1174 containing images.
1175
1176 frame_type: string, optional
1177 Filters the images to analyze to only the ones with the given suffix (e.g.
1178 setting `frame_type`=".png" will only analyze ".png" images). The default
1179 behavior analyzes all ".jpg", ".jpeg" and ".png" images.
1180
1181 destfolder: str, Path, optional
1182 The directory where the predictions will be stored. If None, the predictions
1183 will be stored in the same directory as the first image given in the `images`
1184 argument (if it's a directory, that directory will be used; if it's an image,
1185 the directory containing the image will be used).
1186
1187 shuffle: int, optional
1188 An integer specifying the shuffle with which to run image analysis.
1189
1190 trainingsetindex: int, optional
1191 Integer specifying which TrainingsetFraction to use. By default, the first one
1192 is used (note that TrainingFraction is a list in config.yaml).
1193
1194 max_individuals: int, optional
1195 The maximum number of individuals to detect in each image. Set to the number of
1196 individuals in the project if None.

Callers

nothing calls this directly

Calls 3

get_shuffle_engineFunction · 0.90
analyze_imagesFunction · 0.90
_load_configFunction · 0.85

Tested by

no test coverage detected