Boundary Sensitive Network (BSN) 源码运行

Boundary Sensitive Network (BSN) 源码运行

BSN论文:https://arxiv.org/abs/1806.02964

BSN源码:https://github.com/wzmsltw/BSN-boundary-sensitive-network.pytorch

BSN pipeline

步骤:

(参考自 BSN 项目内 README.md

1. 下载源码

$ git clone https://github.com/wzmsltw/BSN-boundary-sensitive-network.pytorch.git

2. 下载Dataset

在复现时,直接应用了作者使用TSN提取后的视频特征,特征文件可以从作者提供的百度云链接下载。然后将特征文件放在 ./data/activitynet_feature_cuhk/ 目录下。

如果使用百度云下载,按照作者提供的方法 cat zip_csv_mean_100.z* > csv_mean_100.zip 在Ubuntu系统下解压 csv_mean_100.zip 只能得到 3992 条数据。如果下载好全部的 6 个分卷压缩文件后,在Windows系统下直接解压 zip_csv_mean_100.zip 文件可以得到完整的 19228 条数据。

3. 配置环境

作者源码的运行环境为: Python 2 PyTorch 0.4.1 tensorboardX

配置环境的教程可以参考:

也可以在现有的 Python 3 PyTorch 1.x 环境中运行 ,需要对代码做一些修改。

  • print
  • 遍历字典 keys() 前先转为list

TypeError: ‘dict_keys’ object does not support indexing

self.video_list = list(self.video_dict.keys())
  • lr_scheduler.step()optimizer.step() 之后使用

UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate

for epoch in range(opt["tem_epoch"]):
    train_TEM(train_loader, model, optimizer, epoch, writer, opt)
    test_TEM(test_loader, model, epoch, writer, opt)
    scheduler.step()
  • index 转为整数

TypeError: slice indices must be integers or None or have an index method

    num_videos_per_thread = num_videos // opt["pgm_thread"]
    video_extend = video_scale // 4 + 10

4. 训练

$ sh bsn.sh # 开始训练

# bsn.sh内容:
	python main.py --module TEM --mode train
	python main.py --module TEM --mode inference
	python main.py --module PGM
	python main.py --module PEM --mode train
	python main.py --module PEM --mode inference --pem_batch_size 1
	python main.py --module Post_processing
	python main.py --module Evaluation
$ tensorboard --dir=./runs # 查看训练过程

在执行训练脚本时出现 ImportError :

ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22’ not found

解决方法可以参考 https://blog.csdn.net/jsk_learner/article/details/102468919

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值