PaddleClas icon indicating copy to clipboard operation
PaddleClas copied to clipboard

怎么评估某个属性? how to eval a single attribute?

Open tranngocphuong89 opened this issue 1 year ago • 9 comments

你好。 怎么评估单个属性的 正确性? 当前情况是: 运行 tool/eval.py 时, 时对整个属性列表 进行评估。

Hi. How to evaluate a single attribute? The current situation is: when tool/eval.py is run, the entire property list is evaluated.

tranngocphuong89 avatar Jul 12 '22 08:07 tranngocphuong89

没太理解具体问题。是指评估单张图吗?

RainFrost1 avatar Jul 12 '22 08:07 RainFrost1

谢谢回复。 不是评估单张图,而是 评估 单个属性。 比如 当前 运行这个 评估命令时:

python3 tools/eval.py
-c ./ppcls/configs/PULC/person_attribute/PPLCNet_x1_0.yaml
-o Global.pretrained_model="output/PPLCNet_x1_0/best_model"

是评估所有属性的平均 ma 值。但是我想对单个属性 做评估,比如下面 有很多个属性, 但是我只想 对 “Male” 属性进行评估,看看这个模型针对这个 Male 属性的识别怎么样 [{'attributes': ['Male', 'Age18-60', 'Side', 'Glasses: True', 'Hat: True', 'HoldObjectsInFront: True', 'No bag', 'Upper: LongSleeve UpperStride UpperPlaid', 'Lower: LowerStripe', 'No boots'], 'output': [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}]

tranngocphuong89 avatar Jul 12 '22 10:07 tranngocphuong89

@cuicheng01 看一下吧

RainFrost1 avatar Jul 12 '22 12:07 RainFrost1

目前不支持评测单个属性的mA值,可以在这个函数里,根据需要取出你的属性单独评测。https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/ppcls/metric/metrics.py#L401

cuicheng01 avatar Jul 13 '22 03:07 cuicheng01

谢谢指导。 我按照你的 去做, 最终 我会在这里 更新 做法 , 分享给大家。

tranngocphuong89 avatar Jul 13 '22 03:07 tranngocphuong89

@cuicheng01
我已经按照你的指导去做,做法如下: 1) 目的: 从 numpy array 提取需要评估的属性数据 2) 做法: 在第415行 之前 添加这个三行代码 Att_index = 0 # 需要提取属性的index gt_label = gt_label[: , Att_index : (Att_index + 1)] pred_label = pred_label[ : , Att_index : (Att_index + 1)]

https://github.com/PaddlePaddle/PaddleClas/blob/e1502ac353136e863c2bf32119aaa2c55b4a765a/ppcls/metric/metrics.py#L415

麻烦帮我确认一下上边的做法, 为了能分享给其他人, 省得绕远路。

tranngocphuong89 avatar Jul 13 '22 07:07 tranngocphuong89

可以提一个PR我这边帮忙check下~

cuicheng01 avatar Jul 13 '22 10:07 cuicheng01

@cuicheng01 我不知道 怎么创建一个 push request。 我在我的本地 修改了代码, 然后 push 上去给你们, 不过 push 的时候 , 出现如下通知: 2022-07-14_172124

tranngocphuong89 avatar Jul 14 '22 10:07 tranngocphuong89

1.fork Paddleclas项目到自己的仓库中; 2.把相关的代码提到自己仓库的PaddleClas中; 3.在自己的仓库的PaddleClas里创建push request到官方的PaddleClas中。 另外注意下,提到develop分支中哈

cuicheng01 avatar Jul 18 '22 06:07 cuicheng01