MoonBlvd / tad-IROS2019

Code of the Unsupervised Traffic Accident Detection paper in Pytorch.
MIT License
166 stars 39 forks source link

HEV-I bounding box format (normalized, tlwh/cxcywh)? #10

Open srikanthmalla opened 5 years ago

srikanthmalla commented 5 years ago

Hi Brian, It seems something wrong with the HEV-I boxes, when I plot on corresponding image using frame_id it doesn't look good. Could you let me know what is the format inside the pickels.

Best, Srikanth

srikanthmalla commented 5 years ago

Looks like the following snippet works, (but not sure what is the original format):

def plot_on_image(img, bbox, save_path):
    W, H, n_channels = np.asarray(img).shape    
    bbox[1] -= bbox[3]
    # scale to image
    bbox[0] = bbox[0] * H
    bbox[1] = bbox[1] * W
    bbox[2] = bbox[2] * H
    bbox[3] = bbox[3] * W
    xmin = np.int0(bbox[0]-bbox[2]/2)
    ymin = np.int0(bbox[1]-bbox[3]/2)
    xmax = np.int0(bbox[0]+bbox[2]/2)
    ymax = np.int0(bbox[1]+bbox[3]/2)
    ## opencv
    cv2.rectangle(img, (xmin,ymin),(xmax,ymax), (255,0,0), 2)
    print(bbox[0], bbox[1])
    cv2.circle(img,(np.int0(bbox[0]), np.int0(bbox[1])), 10, (255,0,0), -1)
    cv2.imwrite(save_path, img)
MoonBlvd commented 5 years ago

Hey Srikanth,

If you checkout our ICRA paper, you will be able to find how we did that. I believe the boxes are [x, y, w, h] and the targets suppose to be the change of [x, y, w, h] with respect to the frame you curretly observe.

srikanthmalla commented 5 years ago

Can you share the script for HEV-I dataset (it seems unnormalization and plotting using opencv doesn't work straightforward). It would be great if you can share.

Best, Srikanth

srikanthmalla commented 5 years ago

Hi Brian, I think I found the issue, it is the scale of the image (it is different from the original size, like mentioned in the paper). I'll check that and close this issue.

Best, Srikanth

MoonBlvd commented 5 years ago

@srikanthmalla Thank you for letting me know! I was to busy to response yesterday, but good to hear that you have figured out the problem. 👍

srikanthmalla commented 5 years ago

@MoonBlvd Sorry, it's not solved something is wrong. I am not able to plot ground truth boxes properly on the image. I tried different ones, but nothing works. It is off the car.If possible could you give the script that you used to generate normalized boxes (mainly, unnormalize and plot those boxes on image).

MoonBlvd commented 4 years ago

@srikanthmalla Sorry for the delay. Have you solved your problem? I think the bounding boxes are box center (x, y) and box size (w, h), and I have cropped the images from 1280720 to 1280 640 (see the paper)

tianchenji commented 1 year ago

@srikanthmalla @MoonBlvd Do we have an answer to this question? I just tried visualizing the bbox on the image, but the results made me very confused about the data in HEV-I. I essentially followed the visualization code in lib/utils/visualize_utils.py. The bbox in x axis appears to be correct, but there is a constant offset in y axis. An example is shown below: image Did you do any additional operations on y axis in the dataset?

Furthermore, some bbox appears even before the objects appear. Here is an example: image Do you know why this is happening?

HappyZtao commented 1 year ago

@MoonBlvd @tianchenji Hello, I have the same problem as you. The x-axis is correct, but there is an offset on the y-axis. Have you solved this problem?