Skip to content

Latest commit

 

History

History
78 lines (43 loc) · 2.97 KB

README.md

File metadata and controls

78 lines (43 loc) · 2.97 KB

SANet-Keras

An unofficial implementation of SANet for crowd counting in Keras==2.24 + TF==1.14.0.


Paper:

Results now:

On dataset ShanghaiTech B

Still far from the performance in the original paper(MAE 8.4)

MAE MSE MAPE Mean DM Distance
12.41 20.33 0.11 4.942

Dataset:

Env

conda install cudatoolkit=10.0 cudnn=7.6.5

pip install -r requirements.txt

Training Parameters:

  1. Loss = ssim_loss + L2

  2. Optimizer = Adam(lr=1e-4)

  3. Data augmentation: Flip horizontally.

  4. Patch: No patch, input the whole image, output the same shape DM.

  5. Instance normalization: No IN layers at present, since network with IN layers is very hard to train and IN layers didn't show improvement to the network in my experiments.

  6. Output Zeros: The density map output may fade to zeros in 95%+ random initialization, I tried the initialization method in the original paper while it didn't work. In the past, when this happens, I just restarted the kernel and re-run. But now, I tried to train different modules(1-5) separately in the first several epochs to get relatively reasonable weights:

    structure_lite, and it worked out to greatly decrease the probability of the zero-output-phenomena. Any other question, welcome to contact me.

  7. Weights: On SHB, got best weights in 292-th epoch(300 epochs in total), and here is the loss records:

    Loss_records

  8. Prediction example:

    example

Run:

  1. Download dataset;
  2. Data generation: run thegenerate_datasets.ipynb .
  3. Run the main.ipynb to train the model and do the test.

Abstraction:

  1. Network = encoder + decoder, model plot is here:

    Network encoder decoder
    Composition scale aggregation module conv2dTranspose
    Usage extract multi-scale features generate high resolution density map
  2. Loss:

    Loss = loss_formular

  3. Normalization layer:

    • Ease the training process;
    • Reduce 'statistic shift problem'.