cxliu0 / PET

[ICCV 2023] Point-Query Quadtree for Crowd Counting, Localization, and More
MIT License
53 stars 5 forks source link

regarding the QNRF dataset #11

Open yangtle opened 6 months ago

yangtle commented 6 months ago

Dear author,

I have processed the QNRF dataset as per the requirements in your paper, limiting the long edge to within 1536 pixels and training it with a size of 256×256 pixels. I've kept the remaining parameters consistent with SHA and even increased the number of epochs to 3000. I also attempted the suggested changes regarding scale augmentation as you mentioned.

However, the MAE still remains around 100. I firmly believe that it's an issue with my settings. I wanted to ask if there might be a problem with my parameter configuration or if there's an issue with the preprocessing.

Thank you very much for your response.

cxliu0 commented 6 months ago

Here are a few things you may check before training:

little-seasalt commented 5 months ago

Here are a few things you may check before training:

  • Data preprocessing: Please ensure that the images and corresponding ground-truth points are processed properly. For example, you can visualize the scaled annotated points to see whether they are processed correctly. FYI, we use PIL+cv2 to preprocess and save images (as in SHA.py). Sometimes the quality of images may affect the performance.
  • Data augmentation: You may first try to train the model without scale augmentation.
  • Parallel training: We suggest using parallel training to accelerate the training process. For example, using two GPUs to train the model. Optionally, you may set syn_bn to 1.

The MAE of the model I trained can only reach 96, which is still far behind the 79 in the paper. Do you know what may be causing this result? Maybe you would like to share the training code and training parameters of UCF-QNRF?

little-seasalt commented 4 months ago

Here are a few things you may check before training:

  • Data preprocessing: Please ensure that the images and corresponding ground-truth points are processed properly. For example, you can visualize the scaled annotated points to see whether they are processed correctly. FYI, we use PIL+cv2 to preprocess and save images (as in SHA.py). Sometimes the quality of images may affect the performance.
  • Data augmentation: You may first try to train the model without scale augmentation.
  • Parallel training: We suggest using parallel training to accelerate the training process. For example, using two GPUs to train the model. Optionally, you may set syn_bn to 1.

Hello author, I would like to ask if parameters such as K in the model need to be modified when training the UCF-QNRF dataset? Because I trained for a long time and even increased the rounds to 4500, the model index obtained was only 93.5 , there is a certain gap from the paper's indicators. I would like to ask if you can provide the training log of UCF-QNRF

cxliu0 commented 4 months ago

Sorry for the late reply. We notice that the performance on the UCF-QNRF dataset seems somewhat behind the reported results. We will try to figure out the reasons and update accordingly. However, this may take some time.

For your questions:

little-seasalt commented 3 months ago

Sorry for the late reply. We notice that the performance on the UCF-QNRF dataset seems somewhat behind the reported results. We will try to figure out the reasons and update accordingly. However, this may take some time.

For your questions:

  • You don't need to change K when training on the UCF-QNRF dataset.
  • Here are some tips to improve the performance:

    • Data augmentation: You may try to crop non-empty image patches during training, because patches without crowds do not provide valid training supervision.
    • Training loss: You may compare the training loss of SHA and UCF-QNRF, and monitor if something went wrong during training.
    • Test threshold: While a threshold of 0.5 usually works well, modifying the threshold sometimes improves the performance.

Hello author, have you solved the problem of large differences between the UCF-NRF data set and the paper's indicators?

cxliu0 commented 3 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

little-seasalt commented 3 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

cxliu0 commented 3 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

little-seasalt commented 3 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

ds_idx = den_sort[:len(den_sort)//2]

to

ds_idx = den_sort[1:len(den_sort)//2]

Similarly, this also applies to pet.py L489. This modification aims to eliminate potential abnormal loss. In addition, we plan to update the configurations after we finalize the results. Thanks for your feedback.

Thank you for your answer, I will modify it according to the suggestions you gave. In addition, dear author, may I ask whether the indicators of the NWPU-Crowd data set in the article were obtained by running on the verification set?

cxliu0 commented 3 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

ds_idx = den_sort[:len(den_sort)//2]

to

ds_idx = den_sort[1:len(den_sort)//2]

Similarly, this also applies to pet.py L489. This modification aims to eliminate potential abnormal loss. In addition, we plan to update the configurations after we finalize the results. Thanks for your feedback.

Thank you for your answer, I will modify it according to the suggestions you gave. In addition, dear author, may I ask whether the indicators of the NWPU-Crowd data set in the article were obtained by running on the verification set?

We report the results on the NWPU-Crowd test set (see Table 2).

little-seasalt commented 3 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

ds_idx = den_sort[:len(den_sort)//2]

to

ds_idx = den_sort[1:len(den_sort)//2]

Similarly, this also applies to pet.py L489. This modification aims to eliminate potential abnormal loss. In addition, we plan to update the configurations after we finalize the results. Thanks for your feedback.

Hello, author. I have made the modifications to the code according to your suggestions, but the result of the retrained UCF-QNRF dataset can only reach around 92 after 2500 training epochs. However, the best result before modification was 90. Do you know why this is the case?

cxliu0 commented 3 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

ds_idx = den_sort[:len(den_sort)//2]

to

ds_idx = den_sort[1:len(den_sort)//2]

Similarly, this also applies to pet.py L489. This modification aims to eliminate potential abnormal loss. In addition, we plan to update the configurations after we finalize the results. Thanks for your feedback.

Hello, author. I have made the modifications to the code according to your suggestions, but the result of the retrained UCF-QNRF dataset can only reach around 92 after 2500 training epochs. However, the best result before modification was 90. Do you know why this is the case?

Did you modify img_ds_idx = den_sort[len(den_sort)//2] to img_ds_idx = den_sort[1:len(den_sort)//2] ? In addition, it is recommended to increase the number of training samples in dataloader by a proportion of 1/batch_size, because the above operation deletes a training sample in a batch.

little-seasalt commented 3 months ago

Did you modify img_ds_idx = den_sort[len(den_sort)//2] to img_ds_idx = den_sort[1:len(den_sort)//2] ? In addition, it is recommended to increase the number of training samples in dataloader by a proportion of 1/batch_size, because the above operation deletes a training sample in a batch.

Thanks for your suggestion, I have modified img_ds_idx = den_sort[len(den_sort)//2] to img_ds_idx = den_sort[1:len(den_sort)//2], next I will try to increase the dataloader in the ratio of 1/batch_size The number of training samples in .

little-seasalt commented 3 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

ds_idx = den_sort[:len(den_sort)//2]

to

ds_idx = den_sort[1:len(den_sort)//2]

Similarly, this also applies to pet.py L489. This modification aims to eliminate potential abnormal loss. In addition, we plan to update the configurations after we finalize the results. Thanks for your feedback.

Hello, author. I have made the modifications to the code according to your suggestions, but the result of the retrained UCF-QNRF dataset can only reach around 92 after 2500 training epochs. However, the best result before modification was 90. Do you know why this is the case?

Did you modify img_ds_idx = den_sort[len(den_sort)//2] to img_ds_idx = den_sort[1:len(den_sort)//2] ? In addition, it is recommended to increase the number of training samples in dataloader by a proportion of 1/batch_size, because the above operation deletes a training sample in a batch.

Your proposed increase of training samples in the data loader by a ratio of 1/batch_size, does it mean building an inner loop to add additional samples? Would you like to provide relevant code?

cxliu0 commented 3 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

ds_idx = den_sort[:len(den_sort)//2]

to

ds_idx = den_sort[1:len(den_sort)//2]

Similarly, this also applies to pet.py L489. This modification aims to eliminate potential abnormal loss. In addition, we plan to update the configurations after we finalize the results. Thanks for your feedback.

Hello, author. I have made the modifications to the code according to your suggestions, but the result of the retrained UCF-QNRF dataset can only reach around 92 after 2500 training epochs. However, the best result before modification was 90. Do you know why this is the case?

Did you modify img_ds_idx = den_sort[len(den_sort)//2] to img_ds_idx = den_sort[1:len(den_sort)//2] ? In addition, it is recommended to increase the number of training samples in dataloader by a proportion of 1/batch_size, because the above operation deletes a training sample in a batch.

Your proposed increase of training samples in the data loader by a ratio of 1/batch_size, does it mean building an inner loop to add additional samples? Would you like to provide relevant code?

Adding data resampling in __getitem__ is sufficient.

davidnvq commented 3 months ago

@cxliu0 Thanks the author for providing precious information :+1: . However, it seems undeterministic to attain the same results reported in the paper. I got also 96.1 MAE on UCF-QNRF after 1500 epochs.

@little-seasalt It is useful to follow your reproduced results as well. How about the results that you got on SHB and JHU-Crowd++? Thank you in advance :+1:

In my case, I got the best results (over 5 experiments) 6.97 MAE (11.2 MSE) for SHB with the same code as SHA. And, I got the best results (over 3 experiments) 61.2 MAE (263 MSE) for JHU-Crowd++ test split with preprocessing the inputs as suggested by the author. @cxliu0 May I ask if we have any abnormal issues during reproduction? Thank you.

little-seasalt commented 2 months ago

@cxliu0 Thanks the author for providing precious information 👍 . However, it seems undeterministic to attain the same results reported in the paper. I got also 96.1 MAE on UCF-QNRF after 1500 epochs.

@little-seasalt It is useful to follow your reproduced results as well. How about the results that you got on SHB and JHU-Crowd++? Thank you in advance 👍

In my case, I got the best results (over 5 experiments) 6.97 MAE (11.2 MSE) for SHB with the same code as SHA. And, I got the best results (over 3 experiments) 61.2 MAE (263 MSE) for JHU-Crowd++ test split with preprocessing the inputs as suggested by the author. @cxliu0 May I ask if we have any abnormal issues during reproduction? Thank you.

The best result I got in SHB was 6.63 MAE and the best result I got in JHU-Crowd++ was 59.37 MAE.

little-seasalt commented 2 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

ds_idx = den_sort[:len(den_sort)//2]

to

ds_idx = den_sort[1:len(den_sort)//2]

Similarly, this also applies to pet.py L489. This modification aims to eliminate potential abnormal loss. In addition, we plan to update the configurations after we finalize the results. Thanks for your feedback.

Hello, author. I have made the modifications to the code according to your suggestions, but the result of the retrained UCF-QNRF dataset can only reach around 92 after 2500 training epochs. However, the best result before modification was 90. Do you know why this is the case?

Did you modify img_ds_idx = den_sort[len(den_sort)//2] to img_ds_idx = den_sort[1:len(den_sort)//2] ? In addition, it is recommended to increase the number of training samples in dataloader by a proportion of 1/batch_size, because the above operation deletes a training sample in a batch.

Your proposed increase of training samples in the data loader by a ratio of 1/batch_size, does it mean building an inner loop to add additional samples? Would you like to provide relevant code?

Adding data resampling in __getitem__ is sufficient.

Thanks for your suggestion, I will continue to try to train the UCD-QNRF dataset so that its results are close to the paper's indicators.

little-seasalt commented 2 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

ds_idx = den_sort[:len(den_sort)//2]

to

ds_idx = den_sort[1:len(den_sort)//2]

Similarly, this also applies to pet.py L489. This modification aims to eliminate potential abnormal loss. In addition, we plan to update the configurations after we finalize the results. Thanks for your feedback.

Dear author, after many attempts, I still cannot reproduce the paper indicators of the UCF-QNRF dataset. Can you provide the relevant code to successfully reproduce the indicators? Such as dataloader code and model-related code.

cxliu0 commented 2 months ago

We found that abnormal loss values computed on dense images could affect the performance. A simple workaround is to eliminate such abnormal losses during training.

What modifications should be made to the code? Can you please provide me with the modified code?

While we are still experimenting with some modifications, here is a simple modification you may try:

ds_idx = den_sort[:len(den_sort)//2]

to

ds_idx = den_sort[1:len(den_sort)//2]

Similarly, this also applies to pet.py L489. This modification aims to eliminate potential abnormal loss. In addition, we plan to update the configurations after we finalize the results. Thanks for your feedback.

Dear author, after many attempts, I still cannot reproduce the paper indicators of the UCF-QNRF dataset. Can you provide the relevant code to successfully reproduce the indicators? Such as dataloader code and model-related code.

We plan to update the configurations when we finalize the details. If you urgently want to reproduce the results, we may send you a rough version of the relevant code.

little-seasalt commented 2 months ago

We plan to update the configurations when we finalize the details. If you urgently want to reproduce the results, we may send you a rough version of the relevant code.

Thanks for your answer. I would be grateful if you could send a rough version of the relevant code to yan_seasalt@163.com.

davidnvq commented 2 months ago

We plan to update the configurations when we finalize the details. If you urgently want to reproduce the results, we may send you a rough version of the relevant code.

@cxliu0 May you kindly send that version to me (my email is quang.nguyen.jz@riken.jp ) as well? Thank you very much in advance.

cxliu0 commented 2 months ago

We will send you a rough version of the code in the next few days.

pk429 commented 1 month ago

我们将在接下来的几天内向您发送代码的粗略版本。

您能否将该版本也发送给我(我的电子邮件 1165428689@qq.com)?提前非常感谢你。