CommissarMa / Context-Aware_Crowd_Counting-pytorch

The implementation of Context-Aware Crowd Counting(CVPR2019)
MIT License
68 stars 23 forks source link

when there is less than 4 point gaussian_filter_density get an error #7

Open s-JoL opened 5 years ago

s-JoL commented 5 years ago
~/workspace/xxx/yyy/utils/k_nearest_gaussian_kernel.py in gaussian_filter_density(img, points)
     45         print(pt2d, sigma, gt_count, distances)
     46         density += scipy.ndimage.filters.gaussian_filter(
---> 47             pt2d, sigma, mode='constant')
     48     print('done.')
     49     return density

~/miniconda3/envs/pytorch1.0/lib/python3.7/site-packages/scipy/ndimage/filters.py in gaussian_filter(input, sigma, order, output, mode, cval, truncate)
    287         for axis, sigma, order, mode in axes:
    288             gaussian_filter1d(input, sigma, axis, order, output,
--> 289                               mode, cval, truncate)
    290             input = output
    291     else:

~/miniconda3/envs/pytorch1.0/lib/python3.7/site-packages/scipy/ndimage/filters.py in gaussian_filter1d(input, sigma, axis, order, output, mode, cval, truncate)
    202     sd = float(sigma)
    203     # make the radius of the filter equal to truncate standard deviations
--> 204     lw = int(truncate * sd + 0.5)
    205     # Since we are calling correlate, not convolve, revert the kernel
    206     weights = _gaussian_kernel1d(sigma, order, lw)[::-1]

OverflowError: cannot convert float infinity to integer
lucyandjason commented 4 years ago

I also have this problem ,can you solve it?

Preston-Dong commented 4 years ago

Excuse me, I also met this problem, how did you solve it?