Closed tostenzel closed 1 year ago
Hi Kostadinov,
The conversion from Wildtrack bbox coordinates to coco in wildtrack2mvcoco.py should actually be
x = xmin y = ymin w = xmax - xmin h = ymax - ymin
instead of
x = (xmax + xmin) / 2 y = (ymax + ymin) / 2 w = xmax - xmin h = ymax - ymin
I validated this claim visually with the following code snippet:
from pycocotools.coco import COCO import numpy as np import skimage.io as io from matplotlib import pyplot as plt def check_coco_from_wildtrack(coco_dir='data/WILDTRACK/C1/train', annotation_file='data/WILDTRACK/C1/annotations/train.json', img_id=None): """ Visualize generated COCO data. Only used for debugging. """ if os.path.isdir("debug_images") is False: os.makedirs("debug_images") coco = COCO(annotation_file) cat_ids = coco.getCatIds(catNms=['person']) if img_id == None: img_ids = coco.getImgIds(catIds=cat_ids) for _ in range(20): #_ = 4 #index = np.random.randint(0, len(img_ids)) img_id = img_ids[_] img = coco.loadImgs(img_id)[0] i = io.imread(os.path.join(coco_dir, img['file_name'])) plt.imshow(i) plt.axis('off') ann_ids = coco.getAnnIds(imgIds=img['id'], catIds=cat_ids, iscrowd=None) anns = coco.loadAnns(ann_ids) coco.showAnns(anns, draw_bbox=True) plt.savefig(f'debug_images/debug_{img["file_name"]}') # clear figures/bboxes for next picture plt.clf()
Best Regards Tobias
Hi Tobias,
Yes, you are right. I think I did not update my code to convert it to coco because I noticed the same issue when I first coded it. I will update the script and close the issue. Thanks!
Best, Brian
Hi Kostadinov,
The conversion from Wildtrack bbox coordinates to coco in wildtrack2mvcoco.py should actually be
instead of
I validated this claim visually with the following code snippet:
Best Regards Tobias