MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / show_result

Method show_result

tutorials/qdtrack/qdtrack.py:118–164  ·  view source on GitHub ↗

Visualize tracking results. Args: img (str | ndarray): Filename of loaded image. result (dict): Tracking result. The value of key 'track_results' is ndarray with shape (n, 6) in [id, tl_x, tl_y, br_x, br_y, score] format.

(self,
                    img,
                    result,
                    thickness=1,
                    font_scale=0.5,
                    show=False,
                    out_file=None,
                    wait_time=0,
                    backend='cv2',
                    **kwargs)

Source from the content-addressed store, hash-verified

116 return dict(bbox_results=bbox_result, track_results=track_result)
117
118 def show_result(self,
119 img,
120 result,
121 thickness=1,
122 font_scale=0.5,
123 show=False,
124 out_file=None,
125 wait_time=0,
126 backend='cv2',
127 **kwargs):
128 """Visualize tracking results.
129
130 Args:
131 img (str | ndarray): Filename of loaded image.
132 result (dict): Tracking result.
133 The value of key 'track_results' is ndarray with shape (n, 6)
134 in [id, tl_x, tl_y, br_x, br_y, score] format.
135 The value of key 'bbox_results' is ndarray with shape (n, 5)
136 in [tl_x, tl_y, br_x, br_y, score] format.
137 thickness (int, optional): Thickness of lines. Defaults to 1.
138 font_scale (float, optional): Font scales of texts. Defaults
139 to 0.5.
140 show (bool, optional): Whether show the visualizations on the
141 fly. Defaults to False.
142 out_file (str | None, optional): Output filename. Defaults to None.
143 backend (str, optional): Backend to draw the bounding boxes,
144 options are `cv2` and `plt`. Defaults to 'cv2'.
145
146 Returns:
147 ndarray: Visualized image.
148 """
149 assert isinstance(result, dict)
150 track_result = result.get('track_results', None)
151 bboxes, labels, ids = restore_result(track_result, return_ids=True)
152 img = imshow_tracks(
153 img,
154 bboxes,
155 labels,
156 ids,
157 classes=self.CLASSES,
158 thickness=thickness,
159 font_scale=font_scale,
160 show=show,
161 out_file=out_file,
162 wait_time=wait_time,
163 backend=backend)
164 return img

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected