vt-le/astnet

how to respond to this assertion

Closed this issue · 4 comments

i used your pretrained shangaitech model for testing and got this assertion:

assert scores.shape == labels.shape, f'Ground truth has {labels.shape[0]} frames, BUT got {scores.shape[0]} detected frames!'
AssertionError: Ground truth has 40363 frames, BUT got 40389 detected frames!

i used your pretrained shangaitech model for testing and got this assertion:

assert scores.shape == labels.shape, f'Ground truth has {labels.shape[0]} frames, BUT got {scores.shape[0]} detected frames!' AssertionError: Ground truth has 40363 frames, BUT got 40389 detected frames!

Hi,
Thanks for your interest!

The ShanghaiTech dataset consists of 107 videos, totaling 40,791 testing frames.
We use 4 consecutive preceding frames to predict the fifth frame. Therefore, the ground truth has 40,791 - (107 * 4) = 40,363 frames.

thankyou for responding, can u suggest a way to solve this assertion?
The relevant section of your code from anomaly_util.py is as follows:

for i in range(len(psnr_list)):
        score = anomaly_score(psnr_list[i], np.max(psnr_list[i]), np.min(psnr_list[i]))
        scores = np.concatenate((scores, score), axis=0)
        labels = np.concatenate((labels, mat[i][fp:]), axis=0)
    assert scores.shape == labels.shape, f'Ground truth has {labels.shape[0]} frames, BUT got {scores.shape[0]} detected frames!'

thankyou for responding, can u suggest a way to solve this assertion? The relevant section of your code from anomaly_util.py is as follows:

for i in range(len(psnr_list)):
        score = anomaly_score(psnr_list[i], np.max(psnr_list[i]), np.min(psnr_list[i]))
        scores = np.concatenate((scores, score), axis=0)
        labels = np.concatenate((labels, mat[i][fp:]), axis=0)
    assert scores.shape == labels.shape, f'Ground truth has {labels.shape[0]} frames, BUT got {scores.shape[0]} detected frames!'

I think you can verify the number of testing frames in your dataset. It should be 40,791 frames.

thankyou