Pongpisit-Thanasutives / Variations-of-SFANet-for-Crowd-Counting

The official implementation of "Encoder-Decoder Based Convolutional Neural Networks with Multi-Scale-Aware Modules for Crowd Counting"
https://ieeexplore.ieee.org/document/9413286
GNU General Public License v3.0
110 stars 32 forks source link

Output Image #34

Open viethoang303 opened 1 year ago

viethoang303 commented 1 year ago

Hi author, This code is very interesting. I read code but I didn't see inference code to save and visualize output image. Can you release it?

Pongpisit-Thanasutives commented 1 year ago

Please check Visualization_ShanghaiTech.ipynb and Visualization_UCF-QNRF.ipynb for how to infer and visualize density maps. Suppose that you would like to save density_map (np.array) to fname, you may use the following code.

import matplotlib.pyplot as plt
from matplotlib import cm as CM

plt.gca().set_axis_off()
plt.margins(0, 0)
plt.gca().xaxis.set_major_locator(plt.NullLocator())
plt.gca().yaxis.set_major_locator(plt.NullLocator())
plt.imshow(density_map, cmap = CM.jet)
# to save the plot as an image
plt.savefig(fname=fname, dpi=300)
plt.show()

Hope this helps!

viethoang303 commented 1 year ago

Thank for your reply. I am wanting to draw a dot on head of each person in original image. So how to do that??

li-bowen-official commented 1 year ago

I'm not sure you can get points on the head using density maps. Try using a head detection model, or use a labelling tool like cclabeler.