CSRNet-pytorch icon indicating copy to clipboard operation
CSRNet-pytorch copied to clipboard

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

Open guoqiang01486 opened this issue 7 years ago • 5 comments

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?

guoqiang01486 avatar Nov 26 '18 07:11 guoqiang01486

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.

ZhengPeng7 avatar Nov 28 '18 07:11 ZhengPeng7

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

hellowangqian avatar Aug 28 '19 15:08 hellowangqian

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

ZhengPeng7 avatar Aug 29 '19 04:08 ZhengPeng7

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

elharroussomar avatar Jun 10 '20 00:06 elharroussomar

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

Akbarkhan87 avatar May 27 '21 14:05 Akbarkhan87