Skip to content

Osiris-zou/ETM-RL_main

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enhancing Vision Transformers: Efficient Token Merging for Reduced Information Loss

What is ETM-RL?

ETM-RL Concept Figure

Thanks to ToMe.ETM-RL made improvement based on ToMe.For details on ToMe, please visit http://github.com/facebookresearch/ToMe.

ToMe Pipeline: A straightforward BSM matching process that often leads to information loss, especially for foreground tokens.

ETM-RL Pipeline: Our method features a multi-stage feature enhancement pipeline, including adaptive contextual windows and fixed-radius neighborhood fusion, which significantly preserves critical information and structural integrity.

Usage

1、ETN-RL mainly reduces image information loss through two methods: an adaptive contextual window mechanism and a fixed-radius k-nearest neighbor strategy.We have provided the detailed code for these two methods in the merging.py file and applied them in the method called bipartite_soft_matching_xincheng to replace the original bipartite_soft_matching (BSM) method.If you only want to use one of the methods to enhance your image information, please comment out the others in the corresponding method.

2、We provide a test script -- test.py, which can compress the images you want to process. First, you need to modify the absolute path of the image you want to process, and then choose different r values to perform different degrees of merging. r=1 indicates a low degree of merging, while r=25 indicates a very high degree of merging.Then run:

python test.py

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages