Open viethoang303 opened 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!
Thank for your reply. I am wanting to draw a dot on head of each person in original image. So how to do that??
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.
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?