Open twmht opened 5 years ago
@twmht I guess if the map is large enough(ideal), the sum is strictly equals to the ground truth. However, the map has fixed size, after the blurring some points near the map edge, a considerable amount of the countNum were 'crop' by the map edge.
That's right. You can still normalize your intensity values of your Gaussian spread to 1 after cropping, but that would also create an incorrect depiction of the crowdedness for the corresponding area.
You can get count m in the mat through the code below
mat_file = loadmat(mat_path)
value_1=mat_file['image_info']
m,n=value_1[0][0][0][0][0].shape
print('there are %d people in this image'%m)
Hi,
you said that the method to generate ground truth is from https://arxiv.org/abs/1608.06197
from that paper, they said
We generate our ground truth by simply blurring each head annotation using a Gaussian kernel normalized to sum to one. This kind of blurring causes the sum of the density map to be the same as the total number of people in the crowd
But I found that the sum of the density map is not exactly the same of the total number of people.
Here is what I've done
img_path = '/home/tumh/crowd/part_A_final/train_data/images/IMG_211.jpg' mat = io.loadmat(img_path.replace('.jpg','.mat').replace('images','ground_truth').replace('IMG_','GT_IMG_')) img= plt.imread(img_path) k = np.zeros((img.shape[0],img.shape[1])) gt = mat["image_info"][0,0][0,0][0] for i in range(0,len(gt)): if int(gt[i][1])<img.shape[0] and int(gt[i][0])<img.shape[1]: k[int(gt[i][1]),int(gt[i][0])]=1 k = gaussian_filter_density(k) print np.sum(k) assert(np.sum(k) == len(gt))
would result
Traceback (most recent call last): File "make_dataset.py", line 71, in <module> assert(np.sum(k) == len(gt)), '{}!= {}'.format(np.sum(k), len(gt)) AssertionError: 185.91192627!= 188
the ground truth is 188, but from the sum of the density map, the count is 185.91192627.
Any advise?
how did you use the Gaussian kernel to blur each head annotation? whats code do we use to blur the head
@BedirYilmaz can you please help me how to calculate PSNR and SSIM of CSRNet model
Hi,
you said that the method to generate ground truth is from https://arxiv.org/abs/1608.06197
from that paper, they said
But I found that the sum of the density map is not exactly the same of the total number of people.
Here is what I've done
would result
the ground truth is 188, but from the sum of the density map, the count is 185.91192627.
Any advise?