DegardinBruno / human-self-learning-anomaly

Code for the paper "Human Activity Analysis: Iterative Weak/Self-Supervised Learning Frameworks for Detecting Abnormal Events", IJCB 2020
Other
42 stars 13 forks source link

weak_classifier error #10

Closed HTLDe closed 2 years ago

HTLDe commented 2 years ago

Hi! I tried this code and got some errors. In AUC def, I got an error stating that notes_test and scores do not match sample.

ValueError: Found input variables with inconsistent numbers of samples: [83, 39840]

How do I adjust scores? I am attaching a picture of the AUC function just in case.

image

DegardinBruno commented 2 years ago

Hey @HTLDe, thank you for your interest in this code base! Is the notes_test size of 83? If so, why is it so small?

I suspect the error could come from the notes_test. Let me know what you think. For any additional information, just ask!

HTLDe commented 2 years ago

Oh. Thanks for your comment! I used 50 fight videos and 50 normal videos as the dataset. So, is the only way to do this is to use all of the datasets?

And I wonder if the csv file format is like this: weak_train.csv {path_to_temporal_segment_file, weak_flag} weak_val.csv {path_to_temporal_segment_file, weak_flag} weak_test.csv {path_to_temporal_segment_file, weak_flag} weak_val_notes.csv {weak_flag_for_val} weak_test_notes.csv {weak_flag_for_test}

strong_train.csv {path_to_c3d_segment_file, weak_flag} strong val.csv {path_to_c3d_segment_file, weak_flag} strong test.csv {path_to_c3d_segment_file, weak_flag} strong_val_notes.csv {weak_flag_for_val} strong_test_notes.csv {weak_flag_for_test}

HTLDe commented 2 years ago

Please solve my curiosity. @DegardinBruno In def auc, It could be seen that the scores unconditionally increased to a multiple of 480. In this case, if the Notes_test is also not multiples of 480, there will be an error in the rock_auc_score. Weak_val_notes in Small dataset have 83 negative flags('1').

I forced the code to proceed in two ways.

  1. I was able to proceed after forcibly multiplying notes_test 480 times in read_annotation.
  2. After adjusting the size of the notes_test to 32, the code proceeded using 'predictions' instead of 'preds_video' in 'scores'.

However, '1' is concentrated in the front, so '1' is too small in Baysian_classifier's score1. Because of this, scores1 has one value, making it impossible to proceed with the Baysian classifier.

To proceed with this process, the dataset consisted of 10 Fight (0-9) and 10 Normal (0-9), and the format of each csv file was written as follows.

weak_train.csv image

weak_val.csv image

weak_val_notes.csv image

The weak_test and weak_test_notes have the same format as weak_val and weak_val_notes.

strong_train.csv image

In the case of strong, the difference from weak is that it contains the paths of 30 features extracted at c3d per image, and the format is the same as weak.

When the number of fight and normal is 50, is it correct to divide by the ratio of train 6 val 2 test 2? Please advise what part was wrong in my process.

DegardinBruno commented 2 years ago

Oh. Thanks for your comment! I used 50 fight videos and 50 normal videos as the dataset. So, is the only way to do this is to use all of the datasets?

No, you can use 50 fight videos and 50 normal videos!

And I wonder if the csv file format is like this: weak_train.csv {path_to_temporal_segment_file, weak_flag} weak_val.csv {path_to_temporal_segment_file, weak_flag} weak_test.csv {path_to_temporal_segment_file, weak_flag} weak_val_notes.csv {weak_flag_for_val} weak_test_notes.csv {weak_flag_for_test}

strong_train.csv {path_to_c3d_segment_file, weak_flag} strong val.csv {path_to_c3d_segment_file, weak_flag} strong test.csv {path_to_c3d_segment_file, weak_flag} strong_val_notes.csv {weak_flag_for_val} strong_test_notes.csv {weak_flag_for_test}

Yes, that's it!

HTLDe commented 2 years ago

My attempt was successful, so I'll log my confusion for those who will try it next time.

The train, val, and test csv files write down the data you want to learn. For weak annotations, the format is: {number_C.txt, 0) The first column is the path to the file created by normalize_C3D and the second column is the weak flag. Weak flag puts a value of 1 if there is at least one 1 in the csv produced through normalize_note. Strong annotations are basically the same as weak annotations, except that each file has 30 features.

val_notes and test_notes are slightly different from the above. These files contain only the label, and the label refers to the entire video frame label, not the weak flag. For example, if you use F_0 and N_0 in val.csv, then val_notes should contain 4320 frame labels from F_0 and 1920 frame labels from N_0. This can be seen in the annotations in the UBI dataset.

In the case of free.csv, both weak and strong must have this file, and the contents must input all data used for train, val, and test.

If any other errors occur, I will create a new issue.

Sumadera2714 commented 2 years ago

我的尝试成功了,所以我会记录下我的困惑,以供下次尝试的人使用。

训练、验证和测试 csv 文件写下您想要学习的数据。 对于弱注释,格式为:{number_C.txt, 0) 第一列是 normalize_C3D 创建的文件的路径,第二列是弱标志。 如果通过 normalize_note 生成的 csv 中至少有一个 1,则弱标志将值 1。 强注释与弱注释基本相同,只是每个文件有 30 个特征。

val_notes 和 test_notes 与上面略有不同。 这些文件只包含标签,标签是指整个视频帧标签,而不是弱标志。 例如,如果您在 val.csv 中使用 F_0 和 N_0,则 val_notes 应包含来自 F_0 的 4320 个帧标签和来自 N_0 的 1920 个帧标签。 这可以在 UBI 数据集中的注释中看到。

对于free.csv,weak和strong都必须有这个文件,内容必须输入所有用于train、val和test的数据。

如果发生任何其他错误,我将创建一个新问题。

i dont know what contents should be put to the test_note.csv and test.csv files. And how to use the dataset. i am a AI noob, so i have a lot of problems when i run this program. i would be appreciate if you are convenient to give me your email to give some advices about this program. looking forward to your early reply