Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Fix add_datasample draw label bug #2859

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions mmaction/visualization/action_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def add_datasample(self,
texts = ['Frame %d of total %d frames' % (frame_idx, tol_video)]
self.set_image(frame)

if draw_gt and 'gt_labels' in data_sample:
if draw_gt and 'gt_label' in data_sample:
gt_labels = data_sample.gt_label
idx = gt_labels.tolist()
class_labels = [''] * len(idx)
Expand All @@ -226,14 +226,15 @@ def add_datasample(self,
prefix = 'Ground truth: '
texts.append(prefix + ('\n' + ' ' * len(prefix)).join(labels))

if draw_pred and 'pred_labels' in data_sample:
pred_labels = data_sample.pred_labels
idx = pred_labels.item.tolist()
if draw_pred and 'pred_label' in data_sample:
pred_labels = data_sample.pred_label
idx = pred_labels.tolist()
score_labels = [''] * len(idx)
class_labels = [''] * len(idx)
if draw_score and 'score' in pred_labels:
if draw_score and 'pred_score' in data_sample:
score_labels = [
f', {pred_labels.score[i].item():.2f}' for i in idx
f', {data_sample.pred_score[i].item():.2f}'
for i in idx
]

if classes is not None:
Expand Down