ZitongYu / CDCN

Central Difference Convolutional Networks (CVPR'20)
Other
553 stars 179 forks source link

test phase problems #5

Closed xiao-keeplearning closed 2 years ago

xiao-keeplearning commented 4 years ago

I try to train 50 epoch and then test on test set. I have a problem with this code. score_norm = torch.sum(map_x)/torch.sum(val_maps[:,frame_t,:,:]) I found for spoof samples, this denominator is always zero. Then, it may lead to score_norm = inf.

Traceback (most recent call last):
  File "train_CDCN.py", line 445, in <module>
    train_test()
  File "train_CDCN.py", line 409, in train_test
val_threshold, test_threshold, val_ACC, val_ACER, test_ACC, test_APCER, test_BPCER, test_ACER, test_ACER_test_threshold = performances(map_score_val_filename, map_score_test_filename)

ValueError: Input contains NaN, infinity or a value too large for dtype('float64').

Can you help solve this problem? I'm confused about the meaning of this line of code

ZitongYu commented 4 years ago

You can follow Load_OULUNPU_valtest.py. Or you can just easily try 'score_norm = torch.mean(map_x)'

clks-wzz commented 4 years ago

I try to train 50 epoch and then test on test set. I have a problem with this code. score_norm = torch.sum(map_x)/torch.sum(val_maps[:,frame_t,:,:]) I found for spoof samples, this denominator is always zero. Then, it may lead to score_norm = inf.

Traceback (most recent call last):
  File "train_CDCN.py", line 445, in <module>
    train_test()
  File "train_CDCN.py", line 409, in train_test
val_threshold, test_threshold, val_ACC, val_ACER, test_ACC, test_APCER, test_BPCER, test_ACER, test_ACER_test_threshold = performances(map_score_val_filename, map_score_test_filename)

ValueError: Input contains NaN, infinity or a value too large for dtype('float64').

Can you help solve this problem? I'm confused about the meaning of this line of code

You can consider val_maps as the mask of face. The score normalization operation aims to only calculate the mean value of depth at the facial area.

superxi commented 4 years ago

Hi . I am also wondering if use 'score_norm = torch.mean(map_x)' as the score of network , it will not be regularized between 0-1 . As we don't know the score range, how to set the threshold ?

ZitongYu commented 4 years ago

Hi . I am also wondering if use 'score_norm = torch.mean(map_x)' as the score of network , it will not be regularized between 0-1 . As we don't know the score range, how to set the threshold ?

I think you can try arbitrary other normalization ways or not normaliztion like 'mean' . It might drop the performance slightly. I don't think it will influence too much. Because the threshold is calculated from EER automatically. What you should do is to keep the same normaliztion/non-normaliztion in your both val and test phase.

baoyu-yuan commented 4 years ago

Hi . I am also wondering if use 'score_norm = torch.mean(map_x)' as the score of network , it will not be regularized between 0-1 . As we don't know the score range, how to set the threshold ?

I think you can try arbitrary other normalization ways or not normaliztion like 'mean' . It might drop the performance slightly. I don't think it will influence too much. Because the threshold is calculated from EER automatically. What you should do is to keep the same normaliztion/non-normaliztion in your both val and test phase.

Hello, in order to abandon depth map during test phase, can I do the normalization without using depth map for both val and test phase ? Do you have any suggestions for doing this ? And if I use the same threshold for the val and test phase, will the performance fall sharply?

baoyu-yuan commented 4 years ago

Hi . I am also wondering if use 'score_norm = torch.mean(map_x)' as the score of network , it will not be regularized between 0-1 . As we don't know the score range, how to set the threshold ?

Have you tried training the model with any other normalization ?

xuhangxuhang commented 4 years ago

I think the code _score_norm = torch.sum(map_x)/torch.sum(val_maps[:,framet,:,:]) means the normalization of the score. If the mean score of the ground truth depth map is 0.80( for instance), and the mean value of the predicted depth map is 0.70, then the normalization score is 7/8=0.875, and this is the final score of this prediction. If the final score is close to 1, then the model infers the result is real. You can use this normalized prediction score as the final score to get the threshold. What puzzles me is that @ZitongYu didn't provide a spoof situation. in a spoof video, torch.sum(val_maps[:,frame_t,:,:] is zero as depth map is a plane. How do you avoid the zero denominator problem? @ZitongYu Till now I implement this method using _score_norm = torch.sum(mapx) , I dropout the denominator part, I will update my results recently.

punitha-valli commented 4 years ago

@clks-wzz @xiao-keeplearning @baorave @superxi @

Can you please tell me about the map_dir and am confused about the train, test and dev images. because in OULU-NPU dataset they provide only the videos,....

Thanks in advance

lalalanding commented 4 years ago

I think the code _score_norm = torch.sum(map_x)/torch.sum(val_maps[:,framet,:,:]) means the normalization of the score. If the mean score of the ground truth depth map is 0.80( for instance), and the mean value of the predicted depth map is 0.70, then the normalization score is 7/8=0.875, and this is the final score of this prediction. If the final score is close to 1, then the model infers the result is real. You can use this normalized prediction score as the final score to get the threshold. What puzzles me is that @ZitongYu didn't provide a spoof situation. in a spoof video, torch.sum(val_maps[:,frame_t,:,:] is zero as depth map is a plane. How do you avoid the zero denominator problem? @ZitongYu Till now I implement this method using _score_norm = torch.sum(mapx) , I dropout the denominator part, I will update my results recently. 你好,请问你知道怎么解决分母为0 的情况了吗?

xuhangxuhang commented 4 years ago

直接用预测的深度图做回归损失传递,不计算错误比例。 hangxu 邮箱:hangxu@my.swjtu.edu.cn 签名由 网易邮箱大师 定制 On 08/26/2020 11:16, lalalanding wrote: I think the code score_norm = torch.sum(map_x)/torch.sum(val_maps[:,frame_t,:,:]) means the normalization of the score. If the mean score of the ground truth depth map is 0.80( for instance), and the mean value of the predicted depth map is 0.70, then the normalization score is 7/8=0.875, and this is the final score of this prediction. If the final score is close to 1, then the model infers the result is real. You can use this normalized prediction score as the final score to get the threshold. What puzzles me is that @ZitongYu didn't provide a spoof situation. in a spoof video, torch.sum(val_maps[:,frame_t,:,:] is zero as depth map is a plane. How do you avoid the zero denominator problem? @ZitongYu Till now I implement this method using score_norm = torch.sum(map_x) , I dropout the denominator part, I will update my results recently. 你好,请问你知道怎么解决分母为0 的情况了吗? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

punitha-valli commented 4 years ago

@xiao-keeplearning @ZitongYu @superxi @baorave @clks-wzz

I have finished mt training part and i got my model,

can anyone please tell me how to go into the test part,..?

because in CVPR2020_paper_codes, we have train.py which includes train, test and Val,

can anyone please tell me how to go into the test when I did with the train

dangnh0611 commented 3 years ago

@punitha-valli Could you share your trained model, or detail process/environments for training phase?

punitha-valli commented 3 years ago

I used torch 1.6.0 , dlib 19.12.0 to train environment

On Sun 6 Dec, 2020, 3:39 PM Nguyen Hong Dang, notifications@github.com wrote:

@punitha-valli https://github.com/punitha-valli Could you share your trained model, or detail process/environments for training phase?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ZitongYu/CDCN/issues/5#issuecomment-739467886, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMM7B22CZUASVLGOOC7OL63STMYMXANCNFSM4LSMKGGA .

liuyuchen6666 commented 3 years ago

@punitha-valli 你好,请问是每隔几秒钟将OULU数据集划分为图片的呢 非常感谢 您是否能分享一下 生成depth map和.dat文件的代码 或者数据 非常感谢 再次谢谢您

luan1412167 commented 3 years ago

@xiao-keeplearning @ZitongYu @superxi @baorave @clks-wzz

I have finished mt training part and i got my model,

can anyone please tell me how to go into the test part,..?

because in CVPR2020_paper_codes, we have train.py which includes train, test and Val,

can anyone please tell me how to go into the test when I did with the train

@punitha-valli @xuhangxuhang Can you share me how to test my trained model? Many thanks

punitha-valli commented 3 years ago

Hi,

You can able to split the code only for testing, You can able to split the Testing part separately, from Load_valtest, utilities,

Hope best for you ,

On Thu, 10 Jun 2021 at 17:12, luan1412167 @.***> wrote:

@xiao-keeplearning https://github.com/xiao-keeplearning @ZitongYu https://github.com/ZitongYu @superxi https://github.com/superxi @baorave https://github.com/baorave @clks-wzz https://github.com/clks-wzz

I have finished mt training part and i got my model,

can anyone please tell me how to go into the test part,..?

because in CVPR2020_paper_codes, we have train.py which includes train, test and Val,

can anyone please tell me how to go into the test when I did with the train

@punitha-valli https://github.com/punitha-valli @xuhangxuhang https://github.com/xuhangxuhang Can you share me how to test my trained model? Many thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ZitongYu/CDCN/issues/5#issuecomment-858454636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMM7B223UVCO3KI2VOLCAMDTSB6XLANCNFSM4LSMKGGA .

luan1412167 commented 3 years ago

@punitha-valli thanks for your help. I'm so appreciated. In testing, I wonder that why author using binary_mask for testing? I'm so confused it

punitha-valli commented 3 years ago

Just to compare the map from Cdcn and with the binary mark,

It's upto you ,. You can skip the binary mark part

On Fri, Jun 11, 2021, 1:34 PM luan1412167 @.***> wrote:

@punitha-valli https://github.com/punitha-valli thanks for your help. I'm so appreciated. In testing, I wonder that why author using binary_mask for testing? I'm so confused it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ZitongYu/CDCN/issues/5#issuecomment-859280633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMM7B23V4ZITS6X53TO4CMTTSGN7RANCNFSM4LSMKGGA .

luan1412167 commented 3 years ago

Just to compare the map from Cdcn and with the binary mark, It's upto you ,. You can skip the binary mark part On Fri, Jun 11, 2021, 1:34 PM luan1412167 @.***> wrote: @punitha-valli https://github.com/punitha-valli thanks for your help. I'm so appreciated. In testing, I wonder that why author using binary_mask for testing? I'm so confused it — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#5 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMM7B23V4ZITS6X53TO4CMTTSGN7RANCNFSM4LSMKGGA .

Many thank you for your information.

quangtn266 commented 2 years ago

Hi all, Can anyone explain how to calculate a threshold ? Because if i use the evaluation code from the author, the threshold isn't correct.