MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / plot_evaluation_results

Function plot_evaluation_results

deeplabcut/utils/visualization.py:440–606  ·  view source on GitHub ↗

Creates labeled images using the results of inference, and saves them to an output folder. Args: df_combined: dataframe with multiindex rows ("labeled-data", video_name, image_name) and columns ("scorer", "individuals", "bodyparts", "coords"). There should be

(
    df_combined: pd.DataFrame,
    project_root: str,
    scorer: str,
    model_name: str,
    output_folder: str,
    in_train_set: bool,
    plot_unique_bodyparts: bool = False,
    mode: str = "bodypart",
    colormap: str = "rainbow",
    dot_size: int = 12,
    alpha_value: float = 0.7,
    p_cutoff: float = 0.6,
    bounding_boxes: dict | None = None,
    bboxes_cutoff: float = 0.6,
    bounding_boxes_color: str = "auto",
)

Source from the content-addressed store, hash-verified

438
439
440def plot_evaluation_results(
441 df_combined: pd.DataFrame,
442 project_root: str,
443 scorer: str,
444 model_name: str,
445 output_folder: str,
446 in_train_set: bool,
447 plot_unique_bodyparts: bool = False,
448 mode: str = "bodypart",
449 colormap: str = "rainbow",
450 dot_size: int = 12,
451 alpha_value: float = 0.7,
452 p_cutoff: float = 0.6,
453 bounding_boxes: dict | None = None,
454 bboxes_cutoff: float = 0.6,
455 bounding_boxes_color: str = "auto",
456) -> None:
457 """Creates labeled images using the results of inference, and saves them to an
458 output folder.
459
460 Args:
461 df_combined: dataframe with multiindex rows ("labeled-data", video_name,
462 image_name) and columns ("scorer", "individuals", "bodyparts", "coords").
463 There should be two scorers: scorer (for ground truth data) and model_name
464 (for prediction data)
465 project_root: the project root path
466 scorer: the name of the scorer for ground truth data in df_combined
467 model_name: the name of the model for predictions in df_combined
468 output_folder: the name of the folder where images should be saved
469 in_train_set: whether df_combined is for train set images
470 plot_unique_bodyparts: whether we should plot unique bodyparts
471 mode: one of {"bodypart", "individual"}. Determines the keypoint color grouping
472 colormap: the colormap to use for keypoints
473 dot_size: the dot size to use for keypoints
474 alpha_value: the alpha value to use for keypoints
475 p_cutoff: the p-cutoff for "confident" keypoints
476 bounding_boxes: dictionary with df_combined rows as keys and bounding boxes
477 (np array for coordinates and np array for confidence).
478 None corresponds to no bounding boxes.
479 bboxes_cutoff: bounding boxes confidence cutoff threshold.
480 bounding_boxes_color: If plotting bounding boxes, this is the color that will be used for bounding boxes.
481 If set to "auto" (default value):
482 - if mode is "bodypart", the bbox color will be a default color
483 - if mode is "individual", each individual's color will be used for its bounding box
484 """
485 if bounding_boxes is None:
486 bounding_boxes = {}
487
488 for row_index, row in df_combined.iterrows():
489 if isinstance(row_index, str):
490 image_rel_path = Path(row_index)
491 data_folder = image_rel_path.parent.parent.name
492 video = image_rel_path.parent.name
493 image = image_rel_path.name
494 else:
495 data_folder, video, image = row_index
496
497 image_path = Path(project_root) / data_folder / video / image

Callers 1

evaluate_snapshotFunction · 0.90

Calls 8

create_minimal_figureFunction · 0.85
get_cmapFunction · 0.85
save_labeled_frameFunction · 0.85
erase_artistsFunction · 0.85
uniqueMethod · 0.80
getMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected