-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alvin-Zeng
committed
Jul 4, 2020
1 parent
46428da
commit 3a0e6ff
Showing
6 changed files
with
154 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ Runhao Zeng*, Wenbing Huang*, Mingkui Tan, Yu Rong, Peilin Zhao, Junzhou Huang, | |
20/12/2019 We have uploaded the RGB features, trained models and evaluation results! We found that increasing the number of proposals to 800 in the testing | ||
further boosts the performance on THUMOS14. We have also updated the proposal list. | ||
|
||
04/07/2020 We have uploaded the I3D features on Anet along with the training configurations files in data/dataset_cfg.yaml. | ||
|
||
|
||
# Contents | ||
---- | ||
|
@@ -75,7 +77,10 @@ You can use the [official ActivityNet downloader][anet_down] to download videos | |
|
||
### Download Features | ||
|
||
Here, we provide the I3D features (RGB+Flow) for training and testing. You can download it from [Google Cloud][features_google] or [Baidu Cloud][features_baidu]. | ||
Here, we provide the I3D features (RGB+Flow) for training and testing. | ||
THUMOS14: You can download it from [Google Cloud][features_google] or [Baidu Cloud][features_baidu]. | ||
Anet: You can download the I3D Flow features from [Baidu Cloud][features_baidu_anet_flow] (password: jbsa) | ||
and the I3D RGB features from [Google Cloud][features_google_anet_rgb] (Note: set the interval to 16 in ops/I3D_Pooling_Anet.py when training with RGB features) | ||
|
||
|
||
## Training PGCN | ||
|
@@ -184,3 +189,5 @@ Runhao Zeng: [email protected] | |
[emv]:https://github.com/zbwglory/MV-release | ||
[features_google]: https://drive.google.com/open?id=1C6829qlU_vfuiPdJSqHz3qSqqc0SDCr_ | ||
[features_baidu]: https://pan.baidu.com/s/1Dqbcm5PKbK-8n0ZT9KzxGA | ||
[features_baidu_anet_flow]: https://pan.baidu.com/s/1irWHfdF8RJCQcy1D10GlfA | ||
[features_google_anet_rgb]: https://drive.google.com/drive/folders/1UHT3S--vo8MCT8AX3ajHE6TcAThDxFlF?usp=sharing |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import torch | ||
import os | ||
import numpy as np | ||
from numpy.random import randint | ||
import pandas as pd | ||
import time | ||
|
||
def I3D_Pooling(prop_indices, vid, ft_path, n_frame, n_seg, vids=None): | ||
# ft_tensor = torch.load(os.path.join(ft_path, vid)) | ||
fts_all_act = [] | ||
fts_all_comp = [] | ||
|
||
if vids is not None: | ||
for cnt, prop in enumerate(prop_indices): | ||
|
||
ft_tensor = torch.load(os.path.join(ft_path, vids[cnt])) | ||
act_s = prop[0] | ||
act_e = prop[1] | ||
comp_s = prop[2] | ||
comp_e = prop[3] | ||
|
||
start_ft = feature_pooling(comp_s, act_s, vid, | ||
n_frame, n_seg, 'max', ft_tensor) | ||
end_ft = feature_pooling(act_e, comp_e, vid, | ||
n_frame, n_seg, 'max', ft_tensor) | ||
act_ft = feature_pooling(act_s, act_e, vid, | ||
n_frame, n_seg, 'max', ft_tensor) | ||
comp_ft = [start_ft, act_ft, end_ft] | ||
comp_ft = torch.cat(comp_ft, dim=0) | ||
|
||
fts_all_act.append(act_ft) | ||
fts_all_comp.append(comp_ft) | ||
else: | ||
ft_tensor = torch.load(os.path.join(ft_path, vid)) | ||
for cnt, prop in enumerate(prop_indices): | ||
|
||
act_s = prop[0] | ||
act_e = prop[1] | ||
comp_s = prop[2] | ||
comp_e = prop[3] | ||
|
||
start_ft = feature_pooling(comp_s, act_s, vid, | ||
n_frame, n_seg, 'max', ft_tensor) | ||
end_ft = feature_pooling(act_e, comp_e, vid, | ||
n_frame, n_seg, 'max', ft_tensor) | ||
act_ft = feature_pooling(act_s, act_e, vid, | ||
n_frame, n_seg, 'max', ft_tensor) | ||
comp_ft = [start_ft, act_ft, end_ft] | ||
comp_ft = torch.cat(comp_ft, dim=0) | ||
|
||
fts_all_act.append(act_ft) | ||
fts_all_comp.append(comp_ft) | ||
|
||
|
||
fts_all_act = torch.stack(fts_all_act) | ||
fts_all_comp = torch.stack(fts_all_comp) | ||
|
||
return fts_all_act, fts_all_comp | ||
|
||
def feature_pooling(start_ind, end_ind, vid, n_frame, n_seg, type, ft_tensor): | ||
#for turn | ||
interval = 8 | ||
clip_length = 64 | ||
|
||
fts_all = [] | ||
|
||
offsets, average_duration = sample_indices(start_ind, end_ind, n_seg) | ||
|
||
ft_num = ft_tensor.size()[0] | ||
|
||
for off in offsets: | ||
|
||
start_unit = int(min(ft_num-1, np.floor(float(start_ind+off)*100/n_frame))) | ||
end_unit = int(min(ft_num-2, np.ceil(float(start_ind+off+average_duration)*100/n_frame))) | ||
|
||
if start_unit < end_unit: | ||
fts_all.append(torch.max(ft_tensor[start_unit: end_unit+1, :], 0)[0]) | ||
else: | ||
fts_all.append(ft_tensor[start_unit]) | ||
|
||
fts_all = torch.cat(fts_all) | ||
|
||
return fts_all.squeeze() | ||
|
||
def sample_indices(start, end, num_seg): | ||
""" | ||
:param record: VideoRecord | ||
:return: list | ||
""" | ||
valid_length = end - start | ||
average_duration = (valid_length + 1) / num_seg | ||
offsets = np.multiply(list(range(num_seg)), average_duration) | ||
|
||
return offsets, average_duration |
Binary file not shown.