Thanks to visit codestin.com
Credit goes to github.com

Skip to content

YatangLiLab/3DKernelVisualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Feature Visualization in 3D Convolutional Neural Networks

arXiv
Chunpeng Li, Ya-tang Li

Official implementation of the paper "Feature Visualization in 3D Convolutional Neural Networks", which can disentangle texture and motion preferences of a target 3D conv kernel with a data-driven decomposition method. It enables interpretable kernel visualizations for 3D models such as I3D, C3D, and 3D VQ-VAE.


πŸ›  Installation

Clone the repository and install the minimal dependencies:

git clone https://github.com/YatangLiLab/3DKernelVisualizer.git
cd 3DKernelVisualizer
pip install -r requirements.txt

πŸ”Œ Optional: Install Extra Dependencies for Specific Models

To support different models, please install their dependencies manually.

  • For C3D:
    There is no extra library needed.
    Download the pretrained weights and place it under the modelzoo/pretrained/ directory.
  • For I3D
    Follow INSTALL.md of SlowFast
    Download the pretrained weights
    Change the config modelzoo/SlowFast/configs/Kinetics/c2/I3D_8x8_R50.yaml
      TRAIN:
        CHECKPOINT_FILE_PATH: # path for download pretrained weights
      NUM_GPUS: 1
  • For 3D VQ-VAE
    Follow VideoGPT for extra dependencies.
    Download the pretrained weights and place it under the modelzoo/pretrained/ directory.

πŸš€ Usage

To visualize:

python run.py --model i3d --output_path ./output

See modelzoo/config.yaml for model-specific options.

πŸ“ Output Files

For each convolutional kernel, the visualization process produces 3 output files, named as {model_name}_{layer_name}_{filter_index}_{type}.gif

Suffix Description
_stage1.gif Stage 1 result: the initial optimal input of target kernel
_deform.gif Decomposition: the second-stage result showing static and dynamic components
_recon.gif Reconstruction: the reconstructed result from decomposed components

All outputs are saved under the --output_path directory.

πŸ’‘ Tip: for best visualization, please assign sigma, scale, max_value in run.py for each kernel of deformation.

πŸ“ˆ Results

Loading may take some time...

  • Visualization of I3D

layer example 1 example 2 example 3
stage 1 I3D s1_pathway0_stem_conv kernel 0 static
I3D s1_pathway0_stem_conv kernel 0
I3D s1_pathway0_stem_conv kernel 1 static
I3D s1_pathway0_stem_conv kernel 1
I3D s1_pathway0_stem_conv kernel 8 static
I3D s1_pathway0_stem_conv kernel 8
stage 2 I3D s2_pathway0_res0_branch2_c kernel 2 static
I3D s2_pathway0_res0_branch2_c kernel 2
I3D s2_pathway0_res0_branch2_c kernel 3 static
I3D s2_pathway0_res0_branch2_c kernel 3
I3D s2_pathway0_res0_branch2_c kernel 8 static
I3D s2_pathway0_res0_branch2_c kernel 8
stage 3 I3D s3_pathway0_res0_branch2_c kernel 0 static
I3D s3_pathway0_res0_branch2_c kernel 0
I3D s3_pathway0_res0_branch2_c kernel 1 static
I3D s3_pathway0_res0_branch2_c kernel 1
I3D s3_pathway0_res0_branch2_c kernel 8 static
I3D s3_pathway0_res0_branch2_c kernel 8
stage 4 I3D s4_pathway0_res0_branch2_c kernel 0 static
I3D s4_pathway0_res0_branch2_c kernel 0
I3D s4_pathway0_res0_branch2_c kernel 1 static
I3D s4_pathway0_res0_branch2_c kernel 1
I3D s4_pathway0_res0_branch2_c kernel 8 static
I3D s4_pathway0_res0_branch2_c kernel 8
stage 5 I3D s5_pathway0_res0_branch2_c kernel 0 static
I3D s5_pathway0_res0_branch2_c kernel 0
I3D s5_pathway0_res0_branch2_c kernel 1 static
I3D s5_pathway0_res0_branch2_c kernel 1
I3D s5_pathway0_res0_branch2_c kernel 4 static
I3D s5_pathway0_res0_branch2_c kernel 4
  • Visualization of C3D

layer example 1 example 2 example 3
conv 1 C3D conv 1 kernel 1 static
C3D conv 1 kernel 1
C3D conv 1 kernel 4 static
C3D conv 1 kernel 4
C3D conv 1 kernel 5 static
C3D conv 1 kernel 5
conv 2 C3D conv 2 kernel 0 static
C3D conv 2 kernel 0
C3D conv 2 kernel 3 static
C3D conv 2 kernel 3
C3D conv 2 kernel 5 static
C3D conv 2 kernel 5
conv 3b C3D conv 3b kernel 1 static
C3D conv 3b kernel 1
C3D conv 3b kernel 5 static
C3D conv 3b kernel 5
C3D conv 3b kernel 8 static
C3D conv 3b kernel 8
conv 4b C3D conv 4b kernel 1 static
C3D conv 4b kernel 1
C3D conv 4b kernel 2 static
C3D conv 4b kernel 2
C3D conv 4b kernel 5 static
C3D conv 4b kernel 5
conv 5b C3D conv 5b kernel 0 static
C3D conv 5b kernel 0
C3D conv 5b kernel 3 static
C3D conv 5b kernel 3
C3D conv 5b kernel 8 static
C3D conv 5b kernel 8
  • Visualization of VQ-VAE

layer example 1 example 2 example 3
enc_c0 VQ-VAE encoder_convs_0 kernel 0 static
VQ-VAE encoder_convs_0 kernel 0
VQ-VAE encoder_convs_0 kernel 2 static
VQ-VAE encoder_convs_0 kernel 2
VQ-VAE encoder_convs_0 kernel 3 static
VQ-VAE encoder_convs_0 kernel 3
enc_s3b5 VQ-VAE encoder_res_stack_3_block_5 kernel 2 static
VQ-VAE encoder_res_stack_3_block_5 kernel 2
VQ-VAE encoder_res_stack_3_block_5 kernel 3 static
VQ-VAE encoder_res_stack_3_block_5 kernel 3
VQ-VAE encoder_res_stack_3_block_5 kernel 4 static
VQ-VAE encoder_res_stack_3_block_5 kernel 4

πŸ“‘ Citation

If you find this code helpful, please cite our paper:

@inproceedings{li20253dkernelvis,
      title={Feature Visualization in 3D Convolutional Neural Networks}, 
      author={Chunpeng Li and Ya-tang Li},
      booktitle={Lecture Notes in Computer Science},
      volume={15862},
      pages={402--412},
      year={2025},
      publisher={Springer},
}

πŸ™ Acknowledgements

This codebase draws inspiration and reuses components from Lucent.
We also acknowledge the use of pretrained weights from SlowFast, VideoGPT, C3D (PyTorch), FlowNetPytorch

πŸ“œ License

This project is under the Apache 2.0 License. See LICENSE for details.

About

code for "Feature Visualization in 3D Convolutional Neural Networks"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages