I want to train the CSRNet model on UCF_CC_50 dataset which has total number of images 50. and face a problem like
I want to train the CSRNet model on UCF_CC_50 dataset but occurring this problem

KeyError  Traceback (most recent call last)    &lt;ipython-input-11-78e054690de5&gt; in &lt;module&gt;  
     4     img= plt.imread(img_path)
     5     k = np.zeros((img.shape[0],img.shape[1]))
***----&gt; 6     gt = mat[&quot;image_info&quot;][0,0][0,0][0]***
     7     for i in range(0,len(gt)):
     8         if int(gt[i][1])&lt;img.shape[0] and int(gt[i][0])&lt;img.shape[1]:

**KeyError: 'image_info'**


----------

enter for img_path in img_paths:
    print (img_path)
    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[&quot;image_info&quot;][0,0][0,0][0]
    for i in range(0,len(gt)):
        if int(gt[i][1])&lt;img.shape[0] and int(gt[i][0])&lt;img.shape[1]:
            k[int(gt[i][1]),int(gt[i][0])]=1
    k = gaussian_filter_density(k)
    with h5py.File(img_path.replace('.jpg','.h5').replace('images','groundtruth'), 'w') as hf:
            hf['density'] = kcode here

---------

The file path is

C:\Users\Gigabyte pc\Desktop\COUNTING\CSRNet-pytorch-master\UCF_CC_50\part_A_final/train_data\images\IMG_1.jpg


Your code does not comply with the structure of the annotation file you are trying to read. Annotations in UCF-50
CC dataset can simply be read by getting the values of the key &quot;annPoints&quot;.
You could apply the following changes to your code to read the x and y coordinates of pointwise human-head annotations:
4 img= plt.imread(img_path)
5 k = np.zeros((img.shape[0],img.shape[1]))
6 gt = mat[&quot;annPoints&quot;]
7 for i in range(0,len(gt)):

