svishwa / crowdcount-mcnn

Single Image Crowd Counting via MCNN (Unofficial Implementation)
MIT License
499 stars 179 forks source link

test script #9

Closed cryax closed 6 years ago

cryax commented 6 years ago

Hi svishwa, Is there any script take an input image and return estimation map or count number?

Is this model accurate on sparse image?

guohaoyu110 commented 6 years ago

you have to feed the estimation map through the neural network to get the count number.

2017-11-10 16:45 GMT+08:00, cryax notifications@github.com:

Hi svishwa, Is there any script take an input image and return estimation map or count number?

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/svishwa/crowdcount-mcnn/issues/9

svishwa commented 6 years ago

guohaoyu110 is right. you can take a look at test.py which does exactly the same thing that you are asking for.

cryax commented 6 years ago

density_map = net(im_data, gt_data) I'm wondering why we need gt_data in estimating density_map?

svishwa commented 6 years ago

gt_data is not required in density_map = net(im_data, gt_data) during inference. You can send gt_data = None and it will work just fine. gt_data is used only in training mode to calculate the loss.

cryax commented 6 years ago

Hi, thanks for your reply, but results are quite inaccurate (I used the final model train for shanghaitechA)

svishwa commented 6 years ago

As you can see from the code below, gt_data is used only in training mode: image

When you say inaccurate - what are the errors you are getting?

How different are they compared to this: image

cryax commented 6 years ago

hi svishwa, I tested on some wild images I downloaded from internet.

svishwa commented 6 years ago

I see. I have observed this too. In fact, when the model trained on ShanghaiTechA is tested on test set of ShanghaiTechB - you will notice a performance gap. This is due to change in distribution of the training and test set. If you want to improve on your own dataset - you will have to fine-tune it first.

cryax commented 6 years ago

hi thanks for your confirm, I'm wondering is this problem due to shortage of training set?

svishwa commented 6 years ago

Quite possible. The number of training images in ShanghaiTech A are less than 300 which is way too low if you expect it to generalize very well to images from the wild.