deeplabcut.core.visualization
Visualization methods for.
Functions:
| Name | Description |
|---|---|
form_figure |
Forms a figure on which to plot images. |
generate_model_output_plots |
Generates model output plots (maps) for an image and saves them to disk. |
visualize_locrefs |
Plots a scoremap and the corresponding location refinement field on an image. |
visualize_paf |
Plots the PAF on top of the image. |
visualize_scoremaps |
Plots scoremaps as an image overlay. |
form_figure
Forms a figure on which to plot images.
Source code in deeplabcut/core/visualization.py
generate_model_output_plots
generate_model_output_plots(
output_folder: Path,
image_name: str,
bodypart_names: list[str],
bodyparts_to_plot: list[str],
image: ndarray,
scmap: ndarray,
locref: ndarray | None = None,
paf: ndarray | None = None,
paf_graph: list[tuple[int, int]] | None = None,
paf_all_in_one: bool = True,
paf_colormap: str = "rainbow",
output_suffix: str = "",
) -> None
Generates model output plots (maps) for an image and saves them to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Path
|
The folder in which the plots should be saved. |
required |
|
str
|
The name of the image for which the plots were generated. |
required |
|
list[str]
|
The names of bodyparts the model outputs. |
required |
|
list[str]
|
The names of bodyparts that should be plot. |
required |
|
ndarray
|
Shape (height, width, channels). The image on which the model was run. |
required |
|
ndarray
|
Shape (height, width, num_bodyparts). The scoremaps output by the model. |
required |
|
ndarray | None
|
Shape (height, width, num_bodyparts, 2). Optionally, the location refinement fields output by the model. |
None
|
|
ndarray | None
|
Shape (height, width, 2 * len(paf_graph)). Optionally, the part-affinity fields output by the model. |
None
|
|
list[tuple[int, int]] | None
|
Must be set if paf is not None. The PAF graph used to assemble. |
None
|
|
bool
|
Whether to plot all PAFs in a single image. |
True
|
|
str
|
The colormap to use for the PAF maps. |
'rainbow'
|
|
str
|
The filename suffix for the maps to output. |
''
|
Source code in deeplabcut/core/visualization.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
visualize_locrefs
visualize_locrefs(
image: ndarray, scmap: ndarray, locref_x: ndarray, locref_y: ndarray, step: int = 5, zoom_width: int = 0
) -> tuple[plt.Figure, plt.Axes]
Plots a scoremap and the corresponding location refinement field on an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
An image as a numpy array of shape (h, w, channels) |
required |
|
ndarray
|
A scoremap of shape (h, w) |
required |
|
ndarray
|
The x-coordinate of the location refinement field, of shape (h, w) |
required |
|
ndarray
|
The y-coordinate of the location refinement field, of shape (h, w) |
required |
|
int
|
The step with which to plot the location refinement field. |
5
|
|
int
|
The zoom width with which to plot the scoremaps. |
0
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
The figure and axis on which the image scoremap and locref field were plot. |
Source code in deeplabcut/core/visualization.py
visualize_paf
visualize_paf(image: ndarray, paf: ndarray, step: int = 5, colors: list | None = None) -> tuple[plt.Figure, plt.Axes]
Plots the PAF on top of the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Shape (height, width, channels). The image on which the model was run. |
required |
|
ndarray
|
Shape (height, width, 2 * len(paf_graph)). The PAF output by the model. |
required |
|
int
|
The step with which to plot the scoremaps. |
5
|
|
list | None
|
The colormap to use. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
The figure and axis on which the image PAF was plot. |
Source code in deeplabcut/core/visualization.py
visualize_scoremaps
Plots scoremaps as an image overlay.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
An image as a numpy array of shape (h, w, channels) |
required |
|
ndarray
|
A scoremap of shape (h, w) |
required |
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
The figure and axis on which the image scoremap was plot. |