"git@developer.sourcefind.cn:change/sglang.git" did not exist on "4ba1eea83f930f546d072a898181687e85eab4d7"
Commit 32d5a722 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower
Browse files

Fix ground truth annotation overflow.

PiperOrigin-RevId: 335759679
parent 85f52928
......@@ -211,8 +211,14 @@ def convert_groundtruths_to_coco_dataset(groundtruths, label_map=None):
num_batches = len(groundtruths['source_id'])
batch_size = groundtruths['source_id'][0].shape[0]
for i in range(num_batches):
max_num_instances = groundtruths['classes'][i].shape[1]
for j in range(batch_size):
num_instances = groundtruths['num_detections'][i][j]
if num_instances > max_num_instances:
logging.warning(
'num_groundtruths is larger than max_num_instances, %d v.s. %d',
num_instances, max_num_instances)
num_instances = max_num_instances
for k in range(int(num_instances)):
ann = {}
ann['image_id'] = int(groundtruths['source_id'][i][j])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment