# BSN **Repository Path**: Btreee/bsn ## Basic Information - **Project Name**: BSN - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-14 - **Last Updated**: 2021-12-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # BSN训练 ``` This repo holds the pytorch-version codes of paper: "BSN: Boundary Sensitive Network for Temporal Action Proposal Generation", which is accepted in ECCV 2018. You can also find tensorflow-version implementation in [[BSN.tensorflow]](https://github.com/wzmsltw/BSN-boundary-sensitive-network). [[Arxiv Preprint]](http://arxiv.org/abs/1806.02964) Temporal action proposal generation is an important yet challenging problem, since temporal proposals with rich action content are indispensable for analysing real-world videos with long duration and high proportion irrelevant content. This problem requires methods not only generating proposals with precise temporal boundaries, but also retrieving proposals to cover truth action instances with high recall and high overlap using relatively fewer proposals. To address these difficulties, we introduce an effective proposal generation method, named Boundary-Sensitive Network (BSN), which adopts “local to global” fashion. Locally, BSN first locates temporal boundaries with high probabilities, then directly combines these boundaries as proposals. Globally, with Boundary-Sensitive Proposal feature, BSN retrieves proposals by evaluating the confidence of whether a proposal contains an action within its region. We conduct experiments on two challenging datasets: ActivityNet-1.3 and THUMOS14, where BSN outperforms other state-of-the-art temporal action proposal generation methods with high recall and high temporal precision. Finally, further experiments demonstrate that by combining existing action classifiers, our method significantly improves the state-of-the-art temporal action detection performance. ``` For more detail:http://arxiv.org/abs/1806.02964 ## Requirements use pytorch, you can use pip or conda to install the requirements ``` # for pip cd $project pip3.7 install -r requirements.txt CANN版本: CANN toolkit_5.0.3 20211018_FrameworkPTAdapter2.0.T308 post3.20210930 固件驱动21.0.3.1 torch版本: torch==1.5.0 torchvision==0.2.2.post3 ``` ## 数据集准备 1.从以下网址获取csv_mean_100作为训练集 百度网盘: https://pan.baidu.com/s/19GI3_-uZbd_XynUO6g-8YQ?_at_=1637292058287#list/path=%2F 或 谷歌网盘: (https://drive.google.com/file/d/1ISemndlSDS2FtqQOKL0t3Cjj9yk2yznF/view?usp=sharing 注意:将解压好的数据集csv_mean_100文件夹放入data/activitynet_feature_cuhk下 文件结构如下: ``` BSN |-- data /数据集文件夹 | |-- activitynet_annotations /注解 | |-- activitynet_feature_cuhk /数据集与数据处理脚本 | |-- csv_mean_100 /数据集 |-- Evaluation /运行结果文件夹 |-- test /脚本文件夹 | |--env_npu.sh /环境配置文件 | |--bsn_npu1p.sh /单卡测试脚本 | |--run_npu1p.sh /单卡测试脚本 | |--run_tem_train_npu8p.sh /8卡TEM训练脚本 | |--run_tem_inference.sh /8卡TEM推理脚本 | |--run_pgm.sh /8卡PGM脚本 | |--run_pem_train_npu8p.sh /8卡PEM训练脚本 | |--run_pem_inference.sh /8卡PEM推理脚本 | |--run_post.sh /8卡后处理脚本 | |--run_eval.sh /8卡精度测试脚本 |-- dataset.py /数据集预处理脚本 |-- loss_function.py /损失函数脚本 |-- models.py /模型脚本 |-- preprocess.py /数据集预处理脚本 |-- eval.py /精度测试脚本 |-- main_1p.py /单卡训练推理脚本 |-- main_8p.py /8卡训练推理脚本 |-- opts.py /数据加载脚本 |-- pgm.py /PGM脚本 |-- post_processing.py /后处理脚本 ``` 将数据集按照以上结构放在代码目录下 ## TRAIN and TEST ### 单p训练、测试 source 环境变量 ``` source ./test/env_npu.sh ``` 精度和性能脚本: ``` bash ./test/run_npu1p.sh ``` **注:精度和性能输出日志保存在output_npu1p.log** ### 多p训练、测试 注意:需要按顺序执行,完成上一步后方可运行下一步 source 环境变量 ``` source ./test/env.sh ``` 1. Training of temporal evaluation module ``` bash ./test/run_tem_train_npu8p.sh ``` **注:TEM性能日志保存在output_npu_0_tem_train.log** 2. Testing of temporal evaluation module ``` bash ./test/run_tem_inference.sh ``` 3. Proposals generation and BSP feature generation ``` bash ./test/run_pgm.sh ``` 4. Training of proposal evaluation module ``` bash ./test/run_pem_train_npu8p.sh ``` **注:PEM性能日志保存在output_npu_0_pem_train.log** 5. Testing of proposal evaluation module ``` bash ./test/run_pem_inference.sh ``` 6. Post processing and generate final results ``` bash ./test/run_post.sh ``` 7. Eval the performance of proposals ``` bash ./test/run_eval.sh ``` **注:精度日志保存在output_npu_eval.log** 所有运行结果保存在 `./output` ## BSN training result | Ac@100 | FPS | Npu_nums | Epochs | AMP_Type | | :----: | :----------------: | :------: | :----: | :------: | | 74.64 | TEM:215 PEM:614 | 1 | 20 | O2 | | 74.47 | TEM:6500 PEM:15000 | 8 | 20 | O2 | ##