crowdcount.data.data_preprocess¶
-
crowdcount.data.data_preprocess.
adaptive_gaussian
(gt, mode='kdtree')[source]¶ - Parameters
gt (numpy.ndarray) – the ground truth to be processed by gaussian filter
mode (str, optional) – the way to generate density map. “uniform”:
- Returns
numpy.ndarray
-
crowdcount.data.data_preprocess.
uniform_gaussian
(gt, sigma=15, radius=4)[source]¶ - Parameters
gt (numpy.ndarray) – the ground truth to be processed by gaussian filter
sigma (scalar or sequence of scalars, optional) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes.
radius (int, optional) – the radius of gaussian kernel
- Returns
numpy.ndarray
-
class
crowdcount.data.data_preprocess.
PreProcess
(root, name='shtu_a')[source]¶ generate density map
- Parameters
root (str) – the root of dataset, only support shtu_a, shtu_b, ucf_qnrf and ucf_cc_50 now. For ShanghaiTech part A and part B, the root should be upper dir over “part_A_final” or “part_B_final”. And for UCF QNRF and UCF CC 50, the root should be upper dir over “Train” and “Test”
name (str, optional) – the name of dataset, must be in [“shtu_a”, “shtu_b”, “ucf_qnrf”, “ucf_cc”]. default: shtu_a
-
process
(mode='uniform', sigma=4, radius=7)[source]¶ generate density map and save.
- Parameters
mode (str, optional) – the way to generate gaussian filter. “uniform”: uniform sigma and radius of filter, the suggestion from C-3-Framework is sigma 15 and radius 7 as the default. “adaptive_kdtree”: use adaptive gaussian kernel with kdtree. “adaptive_voronio”: use adaptive gaussian kernel with voronio map. defalut: uniform.
sigma (int, optional) – the sigma of gaussian filter. default: 4.
radius (int, optional) – the radius of gaussian area. default: 7.