youweiliang / evit

Python code for ICLR 2022 spotlight paper EViT: Expediting Vision Transformers via Token Reorganizations
Apache License 2.0
162 stars 19 forks source link

tokens是什么,为什么在evit.py里赋值none #19

Open Bugs-Bunny01 opened 1 year ago

Bugs-Bunny01 commented 1 year ago

File "C:\Users\17664\Desktop\timesformer - evit2\src\grasping\Models\timeSformer_orig_four.py", line 600, in forward_features_tactile_sliding x, left_token, idx = blk(x, keep_rate[i], tokens[i], get_idx) TypeError: 'NoneType' object is not subscriptable 首先感谢您为视觉开源社区做出的贡献,不过我将您的融合图像块模块添加到我的模型里时报这个错误,tokens被赋值none,为什么显示'NoneType' object is not subscriptable呢? 我的最大疑惑还是tokens到底是什么,为什么在evit.py文件里一直赋值none。tokens是所有的图像块吗?

youweiliang commented 1 year ago

Hi, Thanks for your interest in our paper!

The tokens in evit.py represent the number of reserved tokens. There are actually two ways to control the number of reserved tokens, one is to calculate how many tokens to keep through keep_rate, and the other is to directly use the parameter tokens (if tokens is not None). You can choose any way to control that number.

For the code, if you just provide it with keep_rate and set tokens to a list of None, then it should work.