LoraLinH / Boosting-Crowd-Counting-via-Multifaceted-Attention

Official Implement of CVPR 2022 paper 'Boosting Crowd Counting via Multifaceted Attention'
MIT License
105 stars 19 forks source link

[Question] How to get density maps from input image? #11

Closed marcemq closed 1 year ago

marcemq commented 1 year ago

Hello @LoraLinH :)

Thank you for sharing the code for the 'Boosting Crowd Counting via Multifaceted Attention' paper.

I'm intended to use it for initial step in a crowd forecasting project. I was able to execute test.py file and see the mae and mse results 😊

Now, I want to be able to given an input image get its density map. Checking the paper I think it's an output of the Regression Decoder, but I couldn't found it in the code, so would you please point me how to achieve this?

Big thank you in advance.

LoraLinH commented 1 year ago

You can obtain the density map by 'output = model(input)[0]' in the test.py.

Morales Quispe, Marcela @.***> 于2023εΉ΄5月26ζ—₯周五 02:07ε†™ι“οΌš

Hello @LoraLinH https://github.com/LoraLinH :)

Thank you for sharing the code for the 'Boosting Crowd Counting via Multifaceted Attention' paper.

I'm intended to use it for initial step in a crowd forecasting project. I was able to execute test.py file and see the mae and mse results 😊

Now, I want to be able to given an input image get its density map. Checking the paper I think it's an output of the Regression Decoder, but I couldn't found it in the code, so would you please point me how to achieve this?

Big thank you in advance.

β€” Reply to this email directly, view it on GitHub https://github.com/LoraLinH/Boosting-Crowd-Counting-via-Multifaceted-Attention/issues/11, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVYQMFWDPBXXSHOFFSUYICDXH6NVXANCNFSM6AAAAAAYPGCZ2U . You are receiving this because you were mentioned.Message ID: <LoraLinH/Boosting-Crowd-Counting-via-Multifaceted-Attention/issues/11@ github.com>

marcemq commented 1 year ago

Hello @LoraLinH, thank you for your reply.

I've manage to write such output into an image for the very first iteration, this output is expected right?

test

Code to generate the image:

outputs = model(inputs)[0] # a tensor of [1,1,117,156] and values between 0-1
outImg = outputs[0][0].detach().cpu().numpy()
cv2.imwrite("test.png", outImg*255)