leeyeehoo / CSRNet-pytorch

CSRNet: Dilated Convolutional Neural Networks for Understanding the Highly Congested Scenes
647 stars 261 forks source link

why multiplied by 64 after cv2.resize() in image.py?? #29

Open guoqiang01486 opened 5 years ago

guoqiang01486 commented 5 years ago

hi,leeyeehoo,thank u for the released codes. In image.py, I don't understand the meaning of the code" target = cv2.resize(target,(target.shape[1]/8,target.shape[0]/8),interpolation = cv2.INTER_CUBIC)64 ",maybe the reason is the resize scale is 1/8,but 64 means the pixels64,it is irrelevant to the scale . or it only increases the values of pixels,if so ,why 64 not others. I just want to know why?

ZhengPeng7 commented 5 years ago

hi,leeyeehoo,thank u for the released codes. In image.py, I don't understand the meaning of the code" target = cv2.resize(target,(target.shape[1]/8,target.shape[0]/8),interpolation = cv2.INTER_CUBIC)64 ",maybe the reason is the resize scale is 1/8,but _64 means the pixels_64,it is irrelevant to the scale . or it only increases the values of pixels,if so ,why 64 not others. I just want to know why?

Because 8 8 = 64. Actually, `resize + 64` should be a simplified method of the convolution that sums the 8x8 grid, which I did in my own implementation.

hellowangqian commented 5 years ago

@ZhengPeng7 The operation "resize and then *64" will change the count value (target.sum()) though not significantly.

ZhengPeng7 commented 5 years ago

Certainly, that's why I called it the 'simplified one', and using convolution to do the count is the precise answer.

elharroussomar commented 4 years ago

its give errors why for me. can any one help.

target = cv2.resize(target,(target.shape[1]/8,target.shape[0]/8),interpolation = cv2.INTER_CUBIC)*64 TypeError: integer argument expected, got float

Akbarkhan87 commented 3 years ago

its give errors why for me. can any one help.

target = cv2.resize(target,(target.shape[1]/8,target.shape[0]/8),interpolation = cv2.INTER_CUBIC)*64 TypeError: integer argument expected, got float

Just type target = cv2.resize(target,(target.shape[1]//8,target.shape[0]//8),interpolation = cv2.INTER_CUBIC)*64