Variations-of-SFANet-for-Crowd-Counting icon indicating copy to clipboard operation
Variations-of-SFANet-for-Crowd-Counting copied to clipboard

Output Image

Open viethoang303 opened this issue 1 year ago • 3 comments

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?

viethoang303 avatar Mar 27 '23 04:03 viethoang303

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!

Pongpisit-Thanasutives avatar Mar 29 '23 04:03 Pongpisit-Thanasutives

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

viethoang303 avatar Apr 07 '23 06:04 viethoang303

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.

li-bowen-official avatar Apr 24 '23 01:04 li-bowen-official