1 Star 0 Fork 0

Cheng_Loon/tfm-anomaly-detection

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
calculate_video_level_scores.py 1000 Bytes
一键复制 编辑 原始数据 按行查看 历史
import glob
import numpy as np
models = ["c3d", "lstm"]
for model in models:
normal_predictions_regex = "predictions_{}/Normal*".format(model)
abnormal_predictions_regex = "predictions_{}/[!Normal]*".format(model)
normal_predictions = glob.glob(normal_predictions_regex)
abnormal_predictions = glob.glob(abnormal_predictions_regex)
normal_pos_preds = 0
normal_videos = 0
for vid in normal_predictions:
preds = np.load(vid)
normal_videos += 1
normal_pos_preds += np.max(np.round(preds))
abnormal_pos_preds = 0
abnormal_videos = 0
for vid in abnormal_predictions:
preds = np.load(vid)
abnormal_videos += 1
abnormal_pos_preds += np.max(np.round(preds))
print("MODEL: {}".format(model))
print("Normal videos with positive labels: {} %".format(
100*normal_pos_preds/normal_videos))
print("Abnormal videos with positive labels: {} %".format(
100*abnormal_pos_preds/abnormal_videos))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Cheng_Loon/tfm-anomaly-detection.git
git@gitee.com:Cheng_Loon/tfm-anomaly-detection.git
Cheng_Loon
tfm-anomaly-detection
tfm-anomaly-detection
master

搜索帮助