Ground_truth generation Module

Set of functions to create the ground truth (h5 files) based on .mat files

Crowd_counting.ground_truth.gaussian_filter_density(gt)[source]

This function create the density map by using adaptive kernels

Parameters

gt – path to a .mat file

Returns

the generated density map

Crowd_counting.ground_truth.gt_gen(img_paths, prefix=('IMG', 'GT_IMG'), crowded=True, Verbose=False, img_format='jpg')[source]

Generate h5 ground_truth file based on the paths to the images, save the created h5 files in the same directory as the .mat files

Parameters
  • img_paths (list) – list of paths to the images, as generated by the dir_to_list function

  • prefix – tuple containing two strings if the name of the images and ground_truth files are different (eg : GT_IMG_3.mat is the ground_truth file corresponding to IMG_3.png, then prefix = (‘IMG’,’GT_IMG’))

  • crowded – Wheter or not the images are really crowded. If True the ground truth will be generated with geometric adaptive kernel, if False it will be generated by a simple gaussian

  • img_format – the format of the images, can only take the values ‘png’ and ‘jpg’