Closed alphacoder01 closed 1 year ago
Hi Ashish,
Thanks for asking!
Below is the preprocessing script we used. Basically, we pad each image into a square to preserve the ratio of the bbox:
# the original image shape
width = annotations['width']
height = annotations['height']
# add padding to the image to ensure it becomes a square
side_len = max(width, height)
x_offset = (side_len - width) / 2 # padding margin
y_offset = (side_len - height) / 2
# rescaling (x, y, w, h) to (0, 1)
for obj_info in annotations['object_list']:
x, y, w, h = obj_info['bbox']
x, y, w, h = float(x+x_offset)/side_len, float(y+y_offset)/side_len, float(w)/side_len, float(h)/side_len
Let me know if this answers your question :)
Hi, I was visualising the bboxes of the NSR-1K dataset, the boxes seems incorrect compared to the original-coco boxes.
The boxes for image_id = 45247 in counting.train.json files in [x,y,w,h] format (assumed) are:
[0.75 ,93.37, 273.27, 183.09] and [280.38, 112.05, 202.96, 147.68]
whereas in the original annotations are:[0.75, 56.71, 273.27, 274.91] and [280.38, 84.75, 202.96, 221.75]
The x-axes matches completely but the y-axes is wrong in almost all the images. Here's an example I might be doing this wrong, any help is appreciated!!
Red boxes are taken from NSR-1K dataset, Green are from MSCOCO GT