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

How to visualize the prediction #17

Open
JunbongJang opened this issue Dec 11, 2021 · 4 comments
Open

How to visualize the prediction #17

JunbongJang opened this issue Dec 11, 2021 · 4 comments
Labels
good first issue Good for newcomers

Comments

@JunbongJang
Copy link

JunbongJang commented Dec 11, 2021

Hi

When I run the following command,

python train_net.py --config-file configs/Dance_R_101_3x.yaml --eval-only MODEL.WEIGHTS ./output/r101_3x_model_final.pth 

DANCE model predicts box coordinates and classes but does not produce a segmentation mask, as shown below.
output_image_2

How do I get the segmentation?
Also, which code did you use to visualize the predictions, like the figures in your DANCE paper?

Thank you for your help in advance.

@JunbongJang
Copy link
Author

JunbongJang commented Dec 12, 2021

Dear all,

  1. To get the segmentation, look for the "pred_polys" key among the output of the model in the following function in the detectron2/detectron2/evaluation/evaluator.py
inference_on_dataset(model, data_loader, evaluator)

  1. There is a visualization function in the dance/core/modeling/edge_snake/snake_head.py
vis(image, poly_sample_locations, poly_sample_targets)

If you write some code with two information above, you can get the following image:

vis_single_2

p.s. I had to put the following code in the line 98 of /detectron2/detectron2/data/dataset_mapper.py in order to correctly visualize the predicted boxes and segmentation on the image.

dataset_dict['height'] = image_shape[0]
dataset_dict['width'] = image_shape[1]

Without it, you will get the following image instead.
vis_single_2

@JunbongJang JunbongJang changed the title How do I visualize the prediction? How to visualize the prediction Dec 12, 2021
@lkevinzc
Copy link
Owner

Hi @JunbongJang , sorry for the delayed reply, just saw you have already found a way to obtain the vertices point, nice!

Yes all the predictions need proper scaling since the training / testing operate on some fixed scales.

If you have further questions welcome to leave an issue or email me :)

@lkevinzc lkevinzc added the good first issue Good for newcomers label Dec 12, 2021
@JunbongJang
Copy link
Author

No Problem! @lkevinzc

Thank you for your work.

Your framework will be very useful for my future project.

@bamboopu
Copy link

bamboopu commented Aug 9, 2022

Dear all,

  1. To get the segmentation, look for the "pred_polys" key among the output of the model in the following function in the detectron2/detectron2/evaluation/evaluator.py
inference_on_dataset(model, data_loader, evaluator)
  1. There is a visualization function in the dance/core/modeling/edge_snake/snake_head.py
vis(image, poly_sample_locations, poly_sample_targets)

If you write some code with two information above, you can get the following image:

vis_single_2

p.s. I had to put the following code in the line 98 of /detectron2/detectron2/data/dataset_mapper.py in order to correctly visualize the predicted boxes and segmentation on the image.

dataset_dict['height'] = image_shape[0]
dataset_dict['width'] = image_shape[1]

Without it, you will get the following image instead. vis_single_2

Thanks for your sharing. It works well.

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

No branches or pull requests

3 participants