Comments (6)
Hello, I modified the code according to the method you said, but it still failed to reach the result you showed. I suspect it may be related to the learning rate. Could you please tell me the learning rate and batchsize you have used?
from transreid.
Hello, I modified the code according to the method you said, but it still failed to reach the result you showed. I suspect it may be related to the learning rate. Could you please tell me the learning rate and batchsize you have used?
I also encountered the same situation, the accuracy of the swin model is not as high as expected.
from transreid.
Hi.
Swin transformer performs well in person ReID. There are some results:
Model | Market | Duke |
---|---|---|
Vit-base (Imagenet21k pre-training) | 86.8/94.4 | 78.9/89.3 |
Swin-base (Imagenet21k pre-training) | 89.3/95.4 | 81.2/90.4 |
from transreid.
Thanks! I want to know what codes you have changed?After I changed Backbone to swin-transformer, at the same time, I changed some codes in make_model.py, but the improvement effect is not obvious. Maybe my parameters are not set properly? If possible, can you share your files? It will be very helpful to me. Thanks again.
from transreid.
I only changed the window size for some special resolutions. You can try 224*224 resolution at first., which needs no change. The pre-trained models are pre-trained on ImageNet21K.
def pre_settings(img_size, drop_rate, attn_drop_rate, drop_path_rate):
if img_size in ([256,128],[256,256],[384,128]):
window_size = 8
elif img_size in ([224,224],[224,112]):
window_size =7
elif img_size in ([384,384],[384,192]):
window_size = 12
elif img_size in ([192,192],):
window_size = 6
else:
print('Window size dose not match!')
print('Window size is set to %d'%window_size)
print('using drop_out rate is : {}'.format(drop_rate))
print('using attn_drop_out rate is : {}'.format(attn_drop_rate))
print('using drop_path rate is : {}'.format(drop_path_rate))
return window_size
def swin_base_patch4_window7_224(img_size=224,drop_rate=0.0, attn_drop_rate=0.0, drop_path_rate=0.1,camera_num=0, view_num=0, **kwargs):
window_size = pre_settings(img_size, drop_rate, attn_drop_rate, drop_path_rate)
model = SwinTransformer(img_size = img_size, patch_size=4, window_size=window_size, embed_dim=128, depths=(2, 2, 18, 2), num_heads=(4, 8, 16, 32), drop_path_rate=drop_path_rate, drop_rate=drop_rate, attn_drop_rate=attn_drop_rate, **kwargs)
return model
def swin_small_patch4_window7_224(img_size=224,drop_rate=0.0, attn_drop_rate=0.0, drop_path_rate=0.1,camera_num=0, view_num=0, **kwargs):
window_size = pre_settings(img_size, drop_rate, attn_drop_rate, drop_path_rate)
model = SwinTransformer(img_size = img_size, patch_size=4, window_size=window_size, embed_dim=96, depths=(2, 2, 18, 2), num_heads=(3, 6, 12, 24), drop_path_rate=drop_path_rate, drop_rate=drop_rate, attn_drop_rate=attn_drop_rate, **kwargs)
return model
from transreid.
I only changed the window size for some special resolutions. You can try 224*224 resolution at first., which needs no change. The pre-trained models are pre-trained on ImageNet21K.
def pre_settings(img_size, drop_rate, attn_drop_rate, drop_path_rate): if img_size in ([256,128],[256,256],[384,128]): window_size = 8 elif img_size in ([224,224],[224,112]): window_size =7 elif img_size in ([384,384],[384,192]): window_size = 12 elif img_size in ([192,192],): window_size = 6 else: print('Window size dose not match!') print('Window size is set to %d'%window_size) print('using drop_out rate is : {}'.format(drop_rate)) print('using attn_drop_out rate is : {}'.format(attn_drop_rate)) print('using drop_path rate is : {}'.format(drop_path_rate)) return window_size def swin_base_patch4_window7_224(img_size=224,drop_rate=0.0, attn_drop_rate=0.0, drop_path_rate=0.1,camera_num=0, view_num=0, **kwargs): window_size = pre_settings(img_size, drop_rate, attn_drop_rate, drop_path_rate) model = SwinTransformer(img_size = img_size, patch_size=4, window_size=window_size, embed_dim=128, depths=(2, 2, 18, 2), num_heads=(4, 8, 16, 32), drop_path_rate=drop_path_rate, drop_rate=drop_rate, attn_drop_rate=attn_drop_rate, **kwargs) return model def swin_small_patch4_window7_224(img_size=224,drop_rate=0.0, attn_drop_rate=0.0, drop_path_rate=0.1,camera_num=0, view_num=0, **kwargs): window_size = pre_settings(img_size, drop_rate, attn_drop_rate, drop_path_rate) model = SwinTransformer(img_size = img_size, patch_size=4, window_size=window_size, embed_dim=96, depths=(2, 2, 18, 2), num_heads=(3, 6, 12, 24), drop_path_rate=drop_path_rate, drop_rate=drop_rate, attn_drop_rate=attn_drop_rate, **kwargs) return model
我也在更换为swin-transformer时,遇见了问题,代码中我是加载了预训练模型但似乎没有加载上,效果非常差,请问您能够分享更改为swin transformer完整的backbone代码以及make_model中的代码吗,非常感谢!!
from transreid.
Related Issues (20)
- 对ViT骨干网络细微改动后性能大幅下降 HOT 2
- how to get the feature of one image? HOT 2
- 有人实现了在Occlude-reid上运行的dataloader吗,感谢[email protected]
- Patch Shuffle Operation HOT 1
- Merge different entities!!! HOT 1
- The size of tensor a (6) must match the size of tensor b (160) at non-singleton dimension 0 HOT 5
- KeyError: 'base.cls_token' HOT 4
- 关于Jigsaw模式中超参数的设置 HOT 1
- Did you consider adding temporal info in side info? HOT 2
- The code dosen't work with new versions of cuda HOT 1
- Hyperparams used for AdamW HOT 1
- 预训练的VIT-BASE和torchvision里的vit_b_16是相同吗 HOT 1
- the performance on visible-infrared reid datasets SYSU-MM01 and RegDB
- 尝试复现MSMT17 vit_base 结果时,遇到报错: RuntimeError: The size of tensor a (751) must match the size of tensor b (1041) at non-singleton dimension 0 HOT 1
- 我加入了OccludedREID数据集的测试,但是运行的时候出现以下错误,求解答 HOT 1
- TansReID's pytorch to TensorRT deployment
- SOLDIER
- 跨域测试的问题
- how to solve HOT 1
- 请问如何导出onnx
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from transreid.