KaiyangZhou / deep-person-reid

Torchreid: Deep learning person re-identification in PyTorch.
https://kaiyangzhou.github.io/deep-person-reid/
MIT License
4.34k stars 1.15k forks source link

Person Attribute Recognition Bad Results #474

Open mohamedabdallah1996 opened 3 years ago

mohamedabdallah1996 commented 3 years ago

Hi @KaiyangZhou, Thank you for sharing this awesome work. I trained the person attribute model on the PA100k dataset but the results were not good even after training for 50 epochs. and when I tested the model on another pedestrian dataset, I found that all the ages predicted are between 18-60 and the gender in most cases is Female, so it seems that the model couldn't generalize at all.

This is train.sh file I have used:

#!/bin/bash

# DATASET points to the directory containing pa100k/
DATASET=$1

python main.py \
--root ${DATASET} \
-d pa100k \
-a osnet_maxpool \
--max-epoch 50 \
--stepsize 30 40 \
--batch-size 32 \
--lr 0.065 \
--weight-decay 0.1 \
--optim sgd \
--weighted-bce \
--workers 2 \
--save-dir log/pa100k-new \

and this is the best checkpoint I have reached from training on 50 epochs:

* Results on training dataset*
  # test persons: 80000
  (instance-based)  accuracy:      74.1%
  (instance-based)  precition:     86.2%
  (instance-based)  recall:        81.8%
  (instance-based)  f1-score:      83.9%
  (label-based)     mean accuracy: 74.7%
  mA for each attribute: [0.7885235  0.5895741  0.7921281  0.8762843  0.79650664 0.83377403
 0.910842   0.7555069  0.7318158  0.74571127 0.82972836 0.81787217
 0.5        0.9086494  0.9084281  0.7248938  0.7424557  0.5946979
 0.82764006 0.5        0.54279387 0.62220436 0.9210302  0.7854427
 0.8881847  0.5       ]
--------------------------------------------------------------------------------------------------------
* Results on validation dataset*
  # test persons: 10000
  (instance-based)  accuracy:      66.3%
  (instance-based)  precition:     81.1%
  (instance-based)  recall:        75.9%
  (instance-based)  f1-score:      78.4%
  (label-based)     mean accuracy: 69.3%
  mA for each attribute: [0.71857077 0.50595236 0.73173213 0.79788685 0.7425585  0.85095066
 0.8827498  0.5692705  0.69239503 0.61499643 0.7086385  0.77696896
 0.5        0.8493024  0.84897256 0.6764251  0.65304625 0.5660702
 0.7074451  0.5        0.540404   0.5859255  0.9021193  0.77726436
 0.8210497  0.5       ]

as you can see most of the attributes have very low accuracy. and from what I have seen during the training, the model learns very slowly and the loss oscillate in a very small range during the 50 epoch training.

so, how can I reach to more robust and good result even on the first four attributes (the most important attributes now for me are the age and gender)?

please give me some advice about that. Thank you in advance.

rosall commented 2 years ago

Having the same issue.

lakshaydulani commented 2 years ago

hi everyone did u find a solution?