Coder Social home page Coder Social logo

boheumd / asm-loc Goto Github PK

View Code? Open in Web Editor NEW
37.0 5.0 4.0 2.61 MB

(CVPR2022) ASM-Loc: Action-aware Segment Modeling for Weakly-Supervised Temporal Action Localization

Python 100.00%
video-understanding weakly-supervised-localization temporal-localization

asm-loc's Introduction

ASM-Loc: Action-aware Segment Modeling for Weakly-Supervised Temporal Action Localization (CVPR2022)

The official repository of our paper "ASM-Loc: Action-aware Segment Modeling for Weakly-Supervised Temporal Action Localization" .

Abstract

Weakly-supervised temporal action localization aims to recognize and localize action segments in untrimmed videos given only video-level action labels for training. Without the boundary information of action segments, existing methods mostly rely on multiple instance learning (MIL), where the predictions of unlabeled instances (i.e., video snippets) are supervised by classifying labeled bags (i.e., untrimmed videos). However, this formulation typically treats snippets in a video as independent instances, ignoring the underlying temporal structures within and across action segments. To address this problem, we propose ASM-Loc, a novel WTAL framework that enables explicit, action-aware segment modeling beyond standard MIL-based methods. Our framework entails three segment-centric components: (i) dynamic segment sampling for compensating the contribution of short actions; (ii) intra- and inter-segment attention for modeling action dynamics and capturing temporal dependencies; (iii) pseudo instance-level supervision for improving action boundary prediction. Furthermore, a multi-step refinement strategy is proposed to progressively improve action proposals along the model training process.

Requirements

Required packages are listed in requirements.txt. You can install by running:

pip install -r requirements.txt

Dataset

We evaluate our ASM-Loc on two popular benchmark datasets THUMOS-14 and ActivityNet-1.3. Before running the code, please download the dataset from the link provided in this repo. Unzip it under the data/ folder and make sure the data structure is as below.

 ├── data
     └── THUMOS14
         ├── gt.json
         ├── split_train.txt
         ├── split_test.txt
         └── train
             ├── ...
         └── test
             ├── ...
     └── ActivityNet13
         ├── gt.json
         ├── split_train.txt
         ├── split_test.txt
         └── train
             ├── ...
         └── test
             ├── ...

Running

Training

# For the THUMOS-14 dataset
python main_THUMOS.py --batch_size 16

# For the ActivityNet-v1.3 dataset
python main_ActivityNet.py --batch_size 64

Testing

First, download the checkpoints into "saved_model" directory and pass it as the checkpoint flag.

# For the THUMOS-14 dataset
python main_THUMOS.py --batch_size 16 --test --checkpoint saved_model/THUMOS

# For the ActivityNet-v1.3 dataset
python main_ActivityNet.py --batch_size 64 --test --checkpoint saved_model/ActivityNet

Results

Note that the performance of checkpoints we provided is slightly different than the orignal paper! Details are as follows:

THUMOS-14, mAP@tIoU(%)
0.1 0.2 0.3 0.4 0.5 0.6 0.7 AVG
71.1 65.4 57.4 46.7 36.8 25.5 14.4 45.3
ActivityNet-v1.3, mAP@tIoU(%)
0.5 0.75 0.95 AVG
41.0 24.5 0.6 25.1

Citation

If you find our code or our paper useful for your research, please [★star] this repo and [cite] the following paper:

@article{he2022asm,
  title={ASM-Loc: Action-aware Segment Modeling for Weakly-Supervised Temporal Action Localization},
  author={Bo He and Xitong Yang and Le Kang and Zhiyu Cheng and Xin Zhou and Abhinav Shrivastava},
  journal={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2022}
}

Acknowledgement

We referenced the repos below for the code

asm-loc's People

Contributors

boheumd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

asm-loc's Issues

test metric is lower compared to the Readme on ActivityNet when using the checkpoint u provided


|t-IoU |0.500||0.550||0.600||0.650||0.700||0.750||0.800||0.850||0.900||0.950|

|mAP |0.402||0.370||0.340||0.306||0.270||0.240||0.202||0.159||0.110||0.060|

|Average-mAP: 0.2461

test_fg_cls_loss:0.672 test_bg_cls_loss:2.469 test_abg_cls_loss:2.492
test_pseudo_instance_loss: 0.000
test_loss:5.839
test acc:0.631
test_mAP:0.246

step:0/1, test_mAP:0.2461


|t-IoU |0.500||0.550||0.600||0.650||0.700||0.750||0.800||0.850||0.900||0.950|

|mAP |0.382||0.353||0.327||0.296||0.262||0.233||0.196||0.155||0.109||0.060|

|Average-mAP: 0.2373

test_fg_cls_loss:0.720 test_bg_cls_loss:1.124 test_abg_cls_loss:2.679
test_pseudo_instance_loss: 0.678
test_loss:6.179
test acc:0.598
test_mAP:0.237

step:1/1, test_mAP:0.2373

the step1's result is even lower than step0

error training what can be problem

F:\ProgramData\Anaconda3\envs\alm\python.exe D:/raza/ASM-Loc-main/main_THUMOS.py --batch_size 16
Traceback (most recent call last):
File "D:/raza/ASM-Loc-main/main_THUMOS.py", line 655, in
main(args)
File "D:/raza/ASM-Loc-main/main_THUMOS.py", line 573, in main
train(args, model, train_dataloader, criterion, optimizer, epoch_idx, logger=logger, step=step,
File "D:/raza/ASM-Loc-main/main_THUMOS.py", line 41, in train
dynamic_segment_weights_cumsum] in enumerate(dataloader):
File "F:\ProgramData\Anaconda3\envs\alm\lib\site-packages\torch\utils\data\dataloader.py", line 355, in iter
return self._get_iterator()
File "F:\ProgramData\Anaconda3\envs\alm\lib\site-packages\torch\utils\data\dataloader.py", line 301, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "F:\ProgramData\Anaconda3\envs\alm\lib\site-packages\torch\utils\data\dataloader.py", line 914, in init
w.start()
File "F:\ProgramData\Anaconda3\envs\alm\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "F:\ProgramData\Anaconda3\envs\alm\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "F:\ProgramData\Anaconda3\envs\alm\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "F:\ProgramData\Anaconda3\envs\alm\lib\multiprocessing\popen_spawn_win32.py", line 93, in init
reduction.dump(process_obj, to_child)
File "F:\ProgramData\Anaconda3\envs\alm\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle '_io.TextIOWrapper' object

split_train

Hello and thank you for your work. I would like to ask what is the format of the split_train.txt in the dataset, the data path in front and the annotations in the back? I started with the format of video path + label, but that wasn't quite right

build_dataset文件找不到

大佬您好,感谢您的分享!我最近在阅读您的论文并尝试复现它。环境:python3.7,Ubuntu16.04,requirements.txt里的环境也安装好了。data和datase的文件我是从ACM-Net里下载。
在执行python main_THUMOS.py --batch_size 16时输出:
Traceback (most recent call last):
File "/home/lk/lk/ASM-Loc-main/main_THUMOS.py", line 10, in
from dataset import build_dataset, my_collate_fn
ImportError: cannot import name 'build_dataset' from 'dataset' (/home/lk/lk/ASM-Loc-main/dataset/init.py)

请问我该如何解决上述问题?期待得到您的解答

The saved model provided does not work well

(ALpytorch18python37) F:\ASM-Loc-main> main_THUMOS.py --batch_size 16 --test --checkpoint saved_model/THUMOS
load checkpoint from saved_model/THUMOS
load checkpoint from saved_model/THUMOS\model_step0_last_epoch.pth
100%|██████████| 210/210 [00:24<00:00, 8.53it/s]

|t-IoU |0.100||0.200||0.300||0.400||0.500||0.600||0.700||0.800||0.900|

|mAP |0.053||0.032||0.017||0.009||0.004||0.002||0.001||0.000||0.000|

|Average-mAP: 0.0169

test_fg_cls_loss:0.557 test_bg_cls_loss:1.180 test_abg_cls_loss:1.415
test_pseudo_instance_loss: 0.000
test_loss:1.854
test acc:0.876
test_mAP:0.017

step:0/3, test_mAP:0.0169

100%|██████████| 410/410 [00:33<00:00, 12.23it/s]
load checkpoint from saved_model/THUMOS
load checkpoint from saved_model/THUMOS\model_step1_last_epoch.pth
100%|██████████| 210/210 [00:55<00:00, 3.78it/s]

|t-IoU |0.100||0.200||0.300||0.400||0.500||0.600||0.700||0.800||0.900|

|mAP |0.055||0.030||0.015||0.008||0.004||0.002||0.001||0.000||0.000|

|Average-mAP: 0.0164

test_fg_cls_loss:0.597 test_bg_cls_loss:1.286 test_abg_cls_loss:1.372
test_pseudo_instance_loss: 0.578
test_loss:2.503
test acc:0.862
test_mAP:0.016

step:1/3, test_mAP:0.0164

100%|██████████| 410/410 [01:25<00:00, 4.80it/s]
load checkpoint from saved_model/THUMOS
load checkpoint from saved_model/THUMOS\model_step2_last_epoch.pth
100%|██████████| 210/210 [01:10<00:00, 2.97it/s]

|t-IoU |0.100||0.200||0.300||0.400||0.500||0.600||0.700||0.800||0.900|

|mAP |0.056||0.031||0.017||0.009||0.004||0.002||0.001||0.000||0.000|

|Average-mAP: 0.0170

test_fg_cls_loss:0.558 test_bg_cls_loss:1.088 test_abg_cls_loss:1.495
test_pseudo_instance_loss: 0.570
test_loss:2.420
test acc:0.890
test_mAP:0.017

step:2/3, test_mAP:0.0170

100%|██████████| 410/410 [01:21<00:00, 5.03it/s]
load checkpoint from saved_model/THUMOS
load checkpoint from saved_model/THUMOS\model_step3_best_epoch.pth
100%|██████████| 210/210 [01:25<00:00, 2.44it/s]

|t-IoU |0.100||0.200||0.300||0.400||0.500||0.600||0.700||0.800||0.900|

|mAP |0.059||0.035||0.019||0.010||0.004||0.002||0.001||0.000||0.000|

|Average-mAP: 0.0184

test_fg_cls_loss:0.551 test_bg_cls_loss:0.902 test_abg_cls_loss:1.384
test_pseudo_instance_loss: 0.539
test_loss:2.233
test acc:0.867
test_mAP:0.018

step:3/3, test_mAP:0.0184

Process finished with exit code 0

THUMOS14 testing error

Hi, thanks for your work! I tried testing your model on THUMOS14, downloaded all the files, but I am getting an error. I am on macOS 12.4, python 3.8, with installed requirements.

This is the output for the command python main_THUMOS.py --batch_size 1 --test --checkpoint saved_model/THUMOS:

load checkpoint from saved_model/THUMOS/model_step0_last_epoch.pth
0%| | 0/210 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/Users/borijang/Projects/ASM-Loc/main_THUMOS.py", line 620, in
main(args)
File "/Users/borijang/Projects/ASM-Loc/main_THUMOS.py", line 594, in main
test_log_dict = test(args, model, test_dataloader, criterion, logger=logger)
File "/Users/borijang/Projects/ASM-Loc/main_THUMOS.py", line 113, in test
for vid_name, input_feature, vid_label, vid_len, proposal_bbox, proposal_count_by_video, pseudo_instance_label, dynamic_segment_weights_cumsum in tqdm(dataloader):
File "/opt/miniconda3/envs/asmloc/lib/python3.8/site-packages/tqdm/std.py", line 1195, in iter
for obj in iterable:
File "/opt/miniconda3/envs/asmloc/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 438, in iter
return self._get_iterator()
File "/opt/miniconda3/envs/asmloc/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 384, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "/opt/miniconda3/envs/asmloc/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1048, in init
w.start()
File "/opt/miniconda3/envs/asmloc/lib/python3.8/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/opt/miniconda3/envs/asmloc/lib/python3.8/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/opt/miniconda3/envs/asmloc/lib/python3.8/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/opt/miniconda3/envs/asmloc/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/opt/miniconda3/envs/asmloc/lib/python3.8/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/opt/miniconda3/envs/asmloc/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/opt/miniconda3/envs/asmloc/lib/python3.8/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle '_io.TextIOWrapper' object

--pred_segment_path

Thank you for your wonderful work. Can you provide an example of a json file for the parameter '-- pred_segment_path'? Because I think the loading of this file can use some of the provided proposals.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.