Paper code: “Heuristic Black-box Adversarial Attacks on Video Recognition Models” paper.
UCF-101 and HMDB-51 datasets are preprocessing by the methods in 3D-ResNets-PyTorch.
"dataset_load.py" file loads datasets for the specified model.
Parameters "root_path", "video_path", "annotation_path" need to be customized in "datasets/c3d_dataset/c3d_opt.py".
- Generate the parameters file in pickle format
python c3d_opt.py
C3D and LRCN models are from 3D-ResNets-PyTorch and video_adv respectively.
"models_load.py" file loads models for the specified model and dataset.
Parameter "pretrain_path" is the path of the pretrain model in "video_cls_models/c3d/ucf101_opts.py".
Download here.
- Generate the parameters file in pickle format
python ucf101_opts.py
- Use the path of the parameters file to specify the line 19 in 'video_cls_models/c3d/c3d.py'.
Parameter "pretrain_path" is the path of the pretrain model in "video_cls_models/c3d/hmdb51_opts.py".
Download here.
- Generate the parameters file in pickle format
python hmdb51_opts.py
- Use the path of the parameters file to specify the line 15 in 'video_cls_models/c3d/c3d.py'.
python main.py --dataset_name <hmdb51/ucf101> --model_name <lrcn/c3d> --target <True/False> --del_frame <True/False> --bound <True/False> --bound_threshold <int> --salient_region <True/False> --spatial_ratio <0~1> --spe_id <int>
- target: true/false means targeted/untargeted attack.
- del_frame: if or not use the temporal sparse.
- bound: if or not use the perturbation bound ω.
- bound_threshold: the perturbation bound ω.
- salient_region: if or not use the spatial sparse.
- spatial_ratio: the area ratio of salient region φ.
- spe_id: the id of the sample in the dataset.