I want to train the CSRNet model on UCF_CC_50 dataset but occurring this problem
KeyError Traceback (most recent call last) <ipython-input-11-78e054690de5> in <module> 4 img= plt.imread(img_path) 5 k = np.zeros((img.shape[0],img.shape[1])) ***----> 6 gt = mat["image_info"][0,0][0,0][0]*** 7 for i in range(0,len(gt)): 8 if int(gt[i][1])<img.shape[0] and int(gt[i][0])<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["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)
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