Skip to content

Commit

Permalink
Fix: RandomSamplingNegPos forget to remove gt_ignore_flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangtann committed May 27, 2024
1 parent 905fba5 commit 74124b6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mmdet/datasets/transforms/text_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def check_for_positive_overflow(gt_bboxes, gt_labels, text, tokenizer,
keep_gt_labels.append(gt_labels[i])

return gt_bboxes[keep_box_index], np.array(
keep_gt_labels, dtype=np.long), length
keep_gt_labels, dtype=np.long), length, keep_box_index


def generate_senetence_given_labels(positive_label_list, negative_label_list,
Expand Down Expand Up @@ -164,7 +164,7 @@ def od_aug(self, results):
if '/' in value:
text[key] = random.choice(value.split('/')).strip()

gt_bboxes, gt_labels, positive_caption_length = \
gt_bboxes, gt_labels, positive_caption_length, keep_box_index = \
check_for_positive_overflow(gt_bboxes, gt_labels,
text, self.tokenizer, self.max_tokens)

Expand Down Expand Up @@ -232,6 +232,8 @@ def od_aug(self, results):

results['gt_bboxes'] = gt_bboxes
results['gt_bboxes_labels'] = gt_labels
if results.get('gt_ignore_flags', None) is not None:
results['gt_ignore_flags'] = results['gt_ignore_flags'][keep_box_index]

results['text'] = pheso_caption
results['tokens_positive'] = label_to_positions
Expand Down

0 comments on commit 74124b6

Please sign in to comment.