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

Function make_labeled_image

deeplabcut/utils/visualization.py:51–117  ·  view source on GitHub ↗

Creating a labeled image with the original human labels, as well as the DeepLabCut's!

(
    frame,
    DataCombined,
    imagenr,
    pcutoff,
    Scorers,
    bodyparts,
    colors,
    cfg,
    labels=None,
    scaling=1,
    ax=None,
)

Source from the content-addressed store, hash-verified

49
50
51def make_labeled_image(
52 frame,
53 DataCombined,
54 imagenr,
55 pcutoff,
56 Scorers,
57 bodyparts,
58 colors,
59 cfg,
60 labels=None,
61 scaling=1,
62 ax=None,
63):
64 """Creating a labeled image with the original human labels, as well as the
65 DeepLabCut's!"""
66
67 if labels is None:
68 labels = ["+", ".", "x"]
69 alphavalue = cfg["alphavalue"] # .5
70 dotsize = cfg["dotsize"] # =15
71
72 if ax is None:
73 if np.ndim(frame) > 2: # color image!
74 h, w, numcolors = np.shape(frame)
75 else:
76 h, w = np.shape(frame)
77 _, ax = prepare_figure_axes(w, h, scaling)
78 ax.imshow(frame, "gray")
79 for _scorerindex, loopscorer in enumerate(Scorers):
80 for bpindex, bp in enumerate(bodyparts):
81 if np.isfinite(
82 DataCombined[loopscorer][bp]["y"].iloc[imagenr] + DataCombined[loopscorer][bp]["x"].iloc[imagenr]
83 ):
84 y, x = (
85 int(DataCombined[loopscorer][bp]["y"].iloc[imagenr]),
86 int(DataCombined[loopscorer][bp]["x"].iloc[imagenr]),
87 )
88 if cfg["scorer"] not in loopscorer:
89 p = DataCombined[loopscorer][bp]["likelihood"].iloc[imagenr]
90 if p > pcutoff:
91 ax.plot(
92 x,
93 y,
94 labels[1],
95 ms=dotsize,
96 alpha=alphavalue,
97 color=colors(int(bpindex)),
98 )
99 else:
100 ax.plot(
101 x,
102 y,
103 labels[2],
104 ms=dotsize,
105 alpha=alphavalue,
106 color=colors(int(bpindex)),
107 )
108 else: # this is the human labeler

Callers 1

Calls 2

prepare_figure_axesFunction · 0.85
plotMethod · 0.80

Tested by

no test coverage detected