Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualize the results - please help #13

Closed
NNtamp opened this issue Jul 31, 2022 · 4 comments
Closed

Visualize the results - please help #13

NNtamp opened this issue Jul 31, 2022 · 4 comments

Comments

@NNtamp
Copy link

NNtamp commented Jul 31, 2022

Hi again, even with batch_size of 1 the results seem very promising.

Do you know any convenient way of visualizing the results output? Eg for 000004 image from testing data I got the below result:

{'name': array(['Car', 'Car'], dtype='<U3'),
'truncated': array([0., 0.]),
'occluded': array([0., 0.]),
'alpha': array([-4.2922497, -4.3647017], dtype=float32),
'bbox': array([[280.2791 , 185.48521, 344.42862, 215.91551],
[366.02884, 182.1751 , 407.58246, 204.38509]], dtype=float32),
'dimensions': array([[3.9297729, 1.4563081, 1.673077 ],
[3.8724215, 1.4690247, 1.5991172]], dtype=float32),
'location': array([[-15.700158 , 2.1591296, 38.17403 ],
[-15.8616 , 2.1576223, 51.3538 ]], dtype=float32),
'rotation_y': array([-4.6803393, -4.6631627], dtype=float32),
'score': array([0.8405248 , 0.82384217], dtype=float32),
'boxes_lidar': array([[38.463722 , 15.724873 , -1.6663605, 3.9297729, 1.673077 ,
1.4563081, 3.1095428],
[51.642723 , 15.887928 , -1.5254021, 3.8724215, 1.5991172,
1.4690247, 3.0923662]], dtype=float32),
'frame_id': '000004'}

Do you know how to depict the boundary boxes (in 2D and 3D)? I tried the below code and the results are not correct for the first out of the 2 bboxes of the image.

import pandas as pd
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
from PIL import Image
obj = pd.read_pickle(r'...\result.pkl')

img = Image.open(r'...\SFD\training files\image_2\000004.png')

xmin, ymin, xmax, ymax = obj[0]['bbox'][0]
cat = obj[0]['name'][0]
caption = cat
score = str(obj[0]['score'][0])
vis_util.draw_bounding_box_on_image(img, ymin, xmin, ymax, xmax, display_str_list = [caption, score], use_normalized_coordinates=False)

img.save('viz_test1.png')

Thank you in advance.

@Raiden-cn
Copy link

I think that you should inference the model on your datasets.
And the results will be generated by OpenPCDet in .txt format.

@NNtamp
Copy link
Author

NNtamp commented Aug 1, 2022

Thank you @Raiden-cn for your answer. Actually I inferenced the model in the testing dataset of KITTI 3d, same dataset that the model proposed. The results are coming in a pkl format. Above you can find an example of a result for the 000004 image. For your convenience, you can find the picture attached also. The main issue is that I cant combine visually the results with the image in order to depict the boundary boxes both in 2D and 3d. Do you have any idea?
000004

@LittlePey
Copy link
Owner

Hi, @NNtamp , maybe the following codes are helpful for you to visualize results:
https://github.com/chaomath/open3d-kitti-visualization
https://github.com/kuixu/kitti_object_vis
To generate prediction file in .txt format, you need to open this switch save_to_file.

@NNtamp
Copy link
Author

NNtamp commented Aug 5, 2022

Thank you for this! Worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants