gjy3035 / C-3-Framework

An open-source PyTorch code for crowd counting
MIT License
698 stars 200 forks source link

Counting people #67

Open vml-ds opened 4 years ago

vml-ds commented 4 years ago

Hi! I am new on this vision computer stuff. I am applying your code, using pre-trained models on Shanghai test dataset part B, and I need the total count people on image. I already read your former answers about this topic, but I still don't find the right way to sum the pixels.

here is part of the code

pred_map = pred_map.cpu().data.numpy()[0, 0, :, :]

after this step, I understand that the pixels can be sumed, so...

count = np.sum(pred_map) print("count: ", count) pred = np.sum(pred_map)/100.0 print("pred: ", pred)

but I always get very different numbers (compared to GT) as result (the following is the first outcome from the first image): 1.jpg GT: 22.829575 count: 80.07278 pred: 0.800727767944336

Would you please, give me your feedback about this? The point of all this is finally try this models, on a different dataset (predict).

Thanks in advanced!

gjy3035 commented 4 years ago

Shanghai B is a small-scale dataset, the model is prone to overfitting. I suggest you train a new model on your data or train a pre-trained model on a large-scale dataset (Crowd surv or a combination dataset). If you train the model using the released data, please note that the training data are similar to your own data.

vml-ds commented 4 years ago

Thanks a lot! I will try a new dataset then.