GithubHelp home page GithubHelp logo

jjboy / bmn-boundary-matching-network Goto Github PK

View Code? Open in Web Editor NEW
288.0 288.0 65.0 2.79 MB

A pytorch-version implementation codes of paper: "BMN: Boundary-Matching Network for Temporal Action Proposal Generation", which is accepted in ICCV 2019.

License: MIT License

Python 99.89% Shell 0.11%

bmn-boundary-matching-network's People

Contributors

jjboy 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bmn-boundary-matching-network's Issues

why conv1d group is 4?

In Base Module and Temporal Evaluation Module,all of the conv1d layer group=4,but I haven't say the param in paper.

The effect of temporal scale on this model and hyperparameters.

In default BMN, the temporal scale is 100.
if I want to generate 200*200 proposal map by feature with 200-length, need I change some hyperparameters ?

For instance, need I change the positive threshold of cls_pem_loss or three thresholds of reg_pem_loss ?
Is there anything else that needs to be modified

the pth file cannot be decompressed

i download the BMN_best.pth.tar from the BaiduYun(pan.baidu.com) link u provided, for 2 times, both cannot be decompressed.

>tar -xvf BMN_best.pth.tar
tar: Error opening archive: Unrecognized archive format

Could u pls. help to check if the compressed file corrupted?

Getting lower results

Hi,

Dowloaded your features, trained and evaluated you model.
I get the following results

train subset video numbers: 9649
validation subset video numbers: 4728
BMN training loss(epoch 0): tem_loss: 1.152, pem_loss: 0.267, total_loss: 1.419
BMN testing loss(epoch 0): tem_loss: 1.184, pem_loss: 0.261, total_loss: 1.445
BMN training loss(epoch 1): tem_loss: 1.095, pem_loss: 0.235, total_loss: 1.329
BMN testing loss(epoch 1): tem_loss: 1.115, pem_loss: 0.231, total_loss: 1.346
BMN training loss(epoch 2): tem_loss: 1.070, pem_loss: 0.223, total_loss: 1.293
BMN testing loss(epoch 2): tem_loss: 1.098, pem_loss: 0.249, total_loss: 1.347
BMN training loss(epoch 3): tem_loss: 1.056, pem_loss: 0.218, total_loss: 1.274
BMN testing loss(epoch 3): tem_loss: 1.103, pem_loss: 0.222, total_loss: 1.325
BMN training loss(epoch 4): tem_loss: 1.042, pem_loss: 0.213, total_loss: 1.255
BMN testing loss(epoch 4): tem_loss: 1.098, pem_loss: 0.225, total_loss: 1.323
BMN training loss(epoch 5): tem_loss: 1.028, pem_loss: 0.210, total_loss: 1.238
BMN testing loss(epoch 5): tem_loss: 1.116, pem_loss: 0.260, total_loss: 1.377
BMN training loss(epoch 6): tem_loss: 1.016, pem_loss: 0.212, total_loss: 1.229
BMN testing loss(epoch 6): tem_loss: 1.101, pem_loss: 0.223, total_loss: 1.324
BMN training loss(epoch 7): tem_loss: 0.999, pem_loss: 0.205, total_loss: 1.204
BMN testing loss(epoch 7): tem_loss: 1.150, pem_loss: 0.222, total_loss: 1.372
BMN training loss(epoch 8): tem_loss: 0.991, pem_loss: 0.204, total_loss: 1.195
BMN testing loss(epoch 8): tem_loss: 1.138, pem_loss: 0.221, total_loss: 1.359
BMN training loss(epoch 9): tem_loss: 0.926, pem_loss: 0.191, total_loss: 1.117
BMN testing loss(epoch 9): tem_loss: 1.163, pem_loss: 0.216, total_loss: 1.379
BMN training loss(epoch 10): tem_loss: 0.901, pem_loss: 0.188, total_loss: 1.089
BMN testing loss(epoch 10): tem_loss: 1.176, pem_loss: 0.215, total_loss: 1.391
BMN training loss(epoch 11): tem_loss: 0.886, pem_loss: 0.187, total_loss: 1.073
BMN testing loss(epoch 11): tem_loss: 1.218, pem_loss: 0.216, total_loss: 1.434
BMN training loss(epoch 12): tem_loss: 0.873, pem_loss: 0.185, total_loss: 1.059
BMN testing loss(epoch 12): tem_loss: 1.237, pem_loss: 0.216, total_loss: 1.453
BMN training loss(epoch 13): tem_loss: 0.863, pem_loss: 0.185, total_loss: 1.048
BMN testing loss(epoch 13): tem_loss: 1.265, pem_loss: 0.217, total_loss: 1.482
BMN training loss(epoch 14): tem_loss: 0.853, pem_loss: 0.183, total_loss: 1.037
BMN testing loss(epoch 14): tem_loss: 1.257, pem_loss: 0.217, total_loss: 1.474

[INIT] Loaded annotations from validation subset.
Number of ground truth instances: 7293
Number of proposals: 472632
Fixed threshold for tiou score: [0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95]
[RESULTS] Performance on ActivityNet proposal task.
Area Under the AR vs AN curve: 63.50907719731249%

Adding an axes using the same arguments as a previous axes currently reuses the earlier instance. In a future version, a new instance will
always be created and returned. Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
"Adding an axes using the same arguments as a previous axes "
AR@1 is 0.31546688605512135
AR@5 is 0.43129027834910183
AR@10 is 0.5023584258878377
AR@100 is 0.7298642533936651

In your paper the Area Under the AR vs AN curve is 67.10 and I'm getting 63.5
and your AR@100 is 75.01 and I'm getting 72.9.

I didn't change your configuration.
Any idea why I'm getting lower results.

Thanks
Ophir

Fix BMN model's structure

Hi, I am a graduate student who is interseted in TAD and hope more communication.
First, thank you for the implementation of BMN. I find BMN model's structure is not the same as introduced in the paper, so I checked the source code by Tianwei Lin. I think the output dimension of x_1d_p and input dimension of x_3d_p may be changed to 128(hidden_dim_2d) as follows:
# Proposal Evaluation Module self.x_1d_p = nn.Sequential( nn.Conv1d(self.hidden_dim_1d, self.hidden_dim_2d, kernel_size=3, padding=1), nn.ReLU(inplace=True) ) self.x_3d_p = nn.Sequential( nn.Conv3d(self.hidden_dim_2d, self.hidden_dim_3d, kernel_size=(self.num_sample, 1, 1),stride=(self.num_sample, 1, 1)), nn.ReLU(inplace=True) )
Lin's source code in this link:
https://github.com/PaddlePaddle/models/blob/release/1.8/PaddleCV/video/models/bmn/bmn_net.py#L141-L149

Best wishes!

Expected Performence

Thanks for your work to implement BMN on PyTorch!

May I ask, what is the model performance that you get?

On my side, the AUC is 64.5% and AR@100 is 73.5. Please find the details below.

I did not change any parameters before running the code. Minor typos were fixed.

+ python main.py --module Evaluation                                                                                                                                        
[INIT] Loaded annotations from validation subset.                                                                                                     
        Number of ground truth instances: 7293                                                                                                                              
        Number of proposals: 472628                                                                                                                   
        Fixed threshold for tiou score: [0.5  0.55 0.6  0.65 0.7  0.75 0.8  0.85 0.9  0.95]                                                                                 
[RESULTS] Performance on ActivityNet proposal task.                                                                                                   
        Area Under the AR vs AN curve: 64.50481283422461%                                                                                                                   
/home/xum/anaconda3/envs/GTAL/lib/python3.7/site-packages/matplotlib/figure.py:98: MatplotlibDeprecationWarning:                                      
Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version,                                                     a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior                               ensured, by passing a unique label to each axes instance.                                                                                                                   
  "Adding an axes using the same arguments as a previous axes "                                                                                       
AR@1 is          0.30287947346770877                                                                                                                                        
AR@5 is          0.43831070889894425                                                                                                                  
AR@10 is         0.5157136980666392                                                                                                                                         
AR@100 is        0.7352392705333882

Non-ASCII character '\xe9' in file main.py

Maybe Chinese characters need to be handled...

$ sh bmn.sh
  File "main.py", line 136
SyntaxError: Non-ASCII character '\xe9' in file main.py on line 136, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
  File "main.py", line 136
SyntaxError: Non-ASCII character '\xe9' in file main.py on line 136, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Code for activity detection

Dear authors,
Thank you for sharing the code of your recent paper BMN. I was wondering if you could also share the code you used for activity detection on ActivityNet (Results from Table 6 of your paper).
Any guidelines to classify your proposals afterwards, and reproduce the results of your paper?
Thank you for you support,
Best,

Visualize Actionness probability Sequence

Hi, thanks for the great work.

For my project, I would like to visualize the the probability actionness score for input video. How can I visualize that sequence? Any help will be appreciated.

Thank you!

About the label and the best_loss

谢谢你的工作,但是在你最新的代码中,opt文件中的"video_info_backup.csv"文件和"anet_anno_action_backup.json"文件好像没有提供,使用的还是之前的label文件?
另外一个问题是:在训练过程中,你使用了best_loss变量,按照我的理解,这应该是一个局部变量,每一个epoch都会初始化为一个极大的值,而每一次保存都是会保存当前epoch的参数?请你确认一下。

any classification related to the module?

Hi,
Very appreciated with your great work!
I'm just start to learn the paper and your code. It seems that there is no classification for any proposals snips of the video for this network. I am not quite sure am I right?

Thanks in advance!

PEM loss=NaN

Thanks a lot for this code!
I simply run the script to train BMN model. However I got PEM loss=NaN , and I find that label confidence is all 0. What 's wrong there?

pem loss nan?

thks for your work. but I found that sometimes the batchsize is 1, pem = loss occurs. why?

about feature extraction

Hi, thanks for the code. I'd like to try this on my own datasets, but when I was extracting features by using TSN, I can only get RGB.jpg and Flow_x_y.jpg. How can I get csv features which is used in your code? (like csv_mean_100/v_oOnKQgQZOZ0.csv) Or can I use jpg to do training and testing?

How to calculate AUC

Hello, May I get your code about AUC-calculating? I didn't find it in class ANET..(I just find some about AR@AN).
Thank you very much!

temporal dimension ???

this repo run on ActivityNet with feature shape 400100,RGB200100 concat flow 200100 ,do you know how to make feature temporal dimension to 100?when i extract feature on Thumos 14 ,I get feature 4096L,L is length of video frames/16. should i do a meanpooling on temporal dimension to fix value???

Training parameters

Thanks for the pytorch codes. I've downloaded the dataset and try to train the model. Could you please tell me your training parameters in the opts.py file? Or you're using all the default parameters?
Thanks.

能不能请你分享THUMOS14的实验代码呢?

您好,我正在尝试复现THUSMO14的实验。并且根据您在issue上的建议,我参考了G-TAD,但是复现的效果跟论文上的结果有点差距。在issue中您说您能复现论文中的效果,不知道可否请您分享一下在THUMOS14上的实验代码呢?非常感谢! @JJBOY

The Proposal Evaluation Module is not Learning

Hi,

I was running the BMN code and saw for all the proposals , the "cls_score" and "reg_score" field which is coming from the Proposal Evaluation Module is coming as 0.5 as shown below. So is it not learning ?

Screenshot 2020-10-06 at 11 08 55 AM

BMN model 没有完成分类任务吗?只完成proposal generation ?

在网络模型的输入中没有发现类别label 信息的载入?太奇怪了,这样自己做一个数据集和修改都不知道从何处 下手。 现在我能把数据集做成 json 文件格式的样子,能够包含起始位置,类型信息等。可以指没看见label类别信息的映射~帮忙指点一下,按照我的理解。比如activitynet 有个200类别,最后肯定有一个分类模块。并且输入输出结果映射指导类别上

about the length of temporal dimension?

Since the training used fixed length of the feature's temporal dimension (~100), is that can be used to unfixed the length of the temporal dimension? and how? thanks a lot.

featureFrame

I read all of the related papers such as TSN & BSN, but I don't understand what is the "featureFrame" in the data_process.py file. what is the difference between this and video frame? why use "16*len(data)" to calculate featureFrame?

Please advise your cuda version

Thanks very much for your great work!

I want to try your work. I installed pytorch0.4.1 and python 3.6. When I run
"python main.py --mode train",
got the following error:

++++++++++++++++++++++++
Traceback (most recent call last):
File "main.py", line 204, in
main(opt)
File "main.py", line 178, in main
BMN_Train(opt)
File "main.py", line 87, in BMN_Train
model = torch.nn.DataParallel(model, device_ids=[0, 1]).cuda()
File "C:\Anaconda\envs\py0.4.1\lib\site-packages\torch\nn\parallel\data_parallel.py", line 111, in init
_check_balance(self.device_ids)
File "C:\Anaconda\envs\py0.4.1\lib\site-packages\torch\nn\parallel\data_parallel.py", line 17, in check_balance
dev_props = [torch.cuda.get_device_properties(i) for i in device_ids]
File "C:\Anaconda\envs\py0.4.1\lib\site-packages\torch\nn\parallel\data_parallel.py", line 17, in
dev_props = [torch.cuda.get_device_properties(i) for i in device_ids]
File "C:\Anaconda\envs\py0.4.1\lib\site-packages\torch\cuda_init
.py", line 292, in get_device_properties
raise AssertionError("Invalid device id")
AssertionError: Invalid device id
+++++++++++++++++++++++++++++

I wonder if it is because the cuda version I installed is different from yours. Please advise the cuda version you used.

Thanks

About video_info_new.csv file

Hi, thanks for your brilliant work!

I've noticed that your program needs the file "video_info_new.csv" in the "./data/activitynet_annotations/" folder to run the evaluation. Could you please tell me how to make this csv file?

Thanks again!

TEM loss is not really decreasing

Hey @JJBOY, thanks for your implementation and I found it extremely useful. I now have a problem during training, the PEM loss is decreasing normally, but TEM loss is not really decreasing, even it's increasing. Do you happen to have experience on how this may happen?

Thanks!

channel_out in PEM x_1d_p

Thank you for your share.

When I was reading your code I found that the number of out_channel in layer x_1d_p (below) is different from that described in paper and official repo. So I am figuring out why? Would it help improving performance?

nn.Conv1d(self.hidden_dim_1d, self.hidden_dim_1d, kernel_size=3, padding=1),

some questions...

  1. What is the meaning of featureframe,is it randomly extract from video then extract feature and reshape to (400,100)?
  2. i have generated featurefrom video,and i extract per frame from 200ms,the length of feature is unfixed because of unfixed video,how can i make its length to be fixed ?
  3. my dataset is hoi video,so the orginal label is (subject,object,relation),but in this project ,the label is action ,how can i present it?
  4. the means of temeporal_scale?

csv_mean_100/v_t_D9MYkEPEo.csv' does not exist

$ python3.6 main.py --mode train
train subset video numbers: 9649
validation subset video numbers: 4728
/home/user/.local/lib/python3.6/site-packages/torch/optim/lr_scheduler.py:100: 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
  "https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate", UserWarning)
Traceback (most recent call last):
  File "main.py", line 204, in <module>
    main(opt)
  File "main.py", line 178, in main
    BMN_Train(opt)
  File "main.py", line 103, in BMN_Train
    train_BMN(train_loader, model, optimizer, epoch, bm_mask)
  File "main.py", line 25, in train_BMN
    for n_iter, (input_data, label_confidence, label_start, label_end) in enumerate(data_loader):
  File "/home/user/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 819, in __next__
    return self._process_data(data)
  File "/home/user/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data
    data.reraise()
  File "/home/user/.local/lib/python3.6/site-packages/torch/_utils.py", line 385, in reraise
    raise self.exc_type(msg)
FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/user/.local/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/user/.local/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/user/.local/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/user/BMN-Boundary-Matching-Network/dataset.py", line 42, in __getitem__
    video_data = self._load_file(index)
  File "/home/user/BMN-Boundary-Matching-Network/dataset.py", line 68, in _load_file
    video_df = pd.read_csv(self.feature_path + "csv_mean_" + str(self.temporal_scale) + "/" + video_name + ".csv")
  File "/home/user/.local/lib/python3.6/site-packages/pandas/io/parsers.py", line 685, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "/home/user/.local/lib/python3.6/site-packages/pandas/io/parsers.py", line 457, in _read
    parser = TextFileReader(fp_or_buf, **kwds)
  File "/home/user/.local/lib/python3.6/site-packages/pandas/io/parsers.py", line 895, in __init__
    self._make_engine(self.engine)
  File "/home/user/.local/lib/python3.6/site-packages/pandas/io/parsers.py", line 1135, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "/home/user/.local/lib/python3.6/site-packages/pandas/io/parsers.py", line 1917, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas/_libs/parsers.pyx", line 382, in pandas._libs.parsers.TextReader.__cinit__
  File "pandas/_libs/parsers.pyx", line 689, in pandas._libs.parsers.TextReader._setup_parser_source
FileNotFoundError: [Errno 2] File b'./data/activitynet_feature_cuhk/csv_mean_100/v_t_D9MYkEPEo.csv' does not exist: b'./data/activitynet_feature_cuhk/csv_mean_100/v_t_D9MYkEPEo.csv'

nan tem_loss in the middle of the traing

Thank you for the great work!

I tried your training program, and printed the loss after each batch. The loss seems correct in the beginning of the training, then "nan" values appear as shown in the following. Wonder if you guessed the possible reasons.
...
BMN training loss(epoch 0): tem_loss: 1.184, pem class_loss: 0.458, pem reg_loss: 0.024, total_loss: 1.883
BMN training loss(epoch 0): tem_loss: 1.184, pem class_loss: 0.458, pem reg_loss: 0.024, total_loss: 1.884
BMN training loss(epoch 0): tem_loss: 1.184, pem class_loss: nan, pem reg_loss: 0.024, total_loss: nan
BMN training loss(epoch 0): tem_loss: nan, pem class_loss: nan, pem reg_loss: 0.024, total_loss: nan

Thanks!

Training speed

Good afternoon!
Thank you very much for your work!
It's great that the model is not only on paddlepaddle.

Could you please share model training speed? I'm using a non-standard environment and would like to compare to the "original".

csv_mean_100/v_nt4Ag91306U.csv does not exist

Hi,

I got this problem of data/activitynet_feature_cuhk/csv_mean_100/v_nt4Ag91306U.csv does not exist. It seems that some of the files are missing.Can you please tell me how to solve this problem?

The number of temporal proposals.

Thanks for sharing your code. I'd like to change the number of temporal proposals of the model, but I couldn't find this parameter. Would you please tell me the specific location?

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.