{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/transformer-based-deep-image-matching-for","title":"TransMatcher: Deep Image Matching Through Transformers for Generalizable Person Re-identification","arxiv_id":"2105.14432","date":"2021-05-30","proceeding":"NeurIPS 2021 12","authors":["Shengcai Liao","Ling Shao"],"abstract":"Transformers have recently gained increasing attention in computer vision. However, existing studies mostly use Transformers for feature representation learning, e.g. for image classification and dense predictions, and the generalizability of Transformers is unknown. In this work, we further investigate the possibility of applying Transformers for image matching and metric learning given pairs of images. We find that the Vision Transformer (ViT) and the vanilla Transformer with decoders are not adequate for image matching due to their lack of image-to-image attention. Thus, we further design two naive solutions, i.e. query-gallery concatenation in ViT, and query-gallery cross-attention in the vanilla Transformer. The latter improves the performance, but it is still limited. This implies that the attention mechanism in Transformers is primarily designed for global feature aggregation, which is not naturally suitable for image matching. Accordingly, we propose a new simplified decoder, which drops the full attention implementation with the softmax weighting, keeping only the query-key similarity computation. Additionally, global max pooling and a multilayer perceptron (MLP) head are applied to decode the matching result. This way, the simplified decoder is computationally more efficient, while at the same time more effective for image matching. The proposed method, called TransMatcher, achieves state-of-the-art performance in generalizable person re-identification, with up to 6.1% and 5.7% performance gains in Rank-1 and mAP, respectively, on several popular datasets. Code is available at https://github.com/ShengcaiLiao/QAConv.","url_abs":"https://arxiv.org/abs/2105.14432v2","url_pdf":"https://arxiv.org/pdf/2105.14432v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"transformer-based-deep-image-matching-for","repo_url":"https://github.com/shengcailiao/QAConv","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"transformer-based-deep-image-matching-for","repo_url":"https://github.com/ShengcaiLiao/TransMatcher","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"generalizable-person-re-identification","task_name":"Generalizable Person Re-identification"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"metric-learning","task_name":"Metric Learning"},{"task_slug":"person-re-identification","task_name":"Person Re-Identification"},{"task_slug":"representation-learning","task_name":"Representation Learning"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"max-pooling","method_name":"Max Pooling"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"},{"method_slug":"vision-transformer","method_name":"Vision Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/generalizable-person-re-identification-on-22","task":"Generalizable Person Re-identification","dataset":"CUHK03-NP (detected)","model":"TransMatcher","rank_in_archive_order":1,"of":5,"metrics":{"ClonedPerson->Rank-1":"25.4","ClonedPerson->mAP":"24.4","MSMT17->Rank-1":"23.7","MSMT17->mAP":"22.5","MSMT17-All->Rank-1":"31.9","MSMT17-All->mAP":"30.7","Market-1501->Rank-1":"22.2","Market-1501->mAP":"21.4","RandPerson->Rank-1":"17.1","RandPerson->mAP":"16.0"},"uses_additional_data":true},{"leaderboard":"/sota/generalizable-person-re-identification-on-20","task":"Generalizable Person Re-identification","dataset":"MSMT17","model":"TransMatcher","rank_in_archive_order":1,"of":4,"metrics":{"ClonedPerson->Rank-1":"51.6","ClonedPerson->mAP":"20.8","Market-1501->Rank1":"47.3","Market-1501->mAP":"18.4","RandPerson->Rank-1":"48.3","RandPerson->mAP":"17.7"},"uses_additional_data":true},{"leaderboard":"/sota/generalizable-person-re-identification-on-21","task":"Generalizable Person Re-identification","dataset":"Market-1501","model":"TransMatcher","rank_in_archive_order":1,"of":5,"metrics":{"ClonedPerson->Rank-1":"84.8","ClonedPerson->mAP":"62.3","MSMT17->Rank-1":"80.1","MSMT17->mAP":"52.0","MSMT17-All->Rank-1":"82.6","MSMT17-All->mAP":"58.4","RandPerson->Rank-1":"77.3","RandPerson->mAP":"49.1"},"uses_additional_data":true}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2105.14432","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2105.14432"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/ShengcaiLiao/QAConv","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/JDAI-CV/fast-reid","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ShengcaiLiao/TransMatcher","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/shengcailiao/QAConv","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":6,"ran_fixture":3,"ran_draft_wrong":1,"unverified":11},"by_repo_kind":{"official":{"samples":12,"ran":2,"repositories":2},"found_in_text":{"samples":8,"ran":7,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":1,"samples":[{"code_sha256_prefix":"ce093271c9f68c89","entry":"Block","repo":"JDAI-CV/fast-reid","repo_kind":"found_in_text","path":"fastreid/modeling/backbones/vision_transformer.py","file_url":"https://github.com/JDAI-CV/fast-reid/blob/HEAD/fastreid/modeling/backbones/vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ce093271c9f68c89"}},{"code_sha256_prefix":"75f5c156267fccbd","entry":"DropPath","repo":"JDAI-CV/fast-reid","repo_kind":"found_in_text","path":"fastreid/modeling/backbones/vision_transformer.py","file_url":"https://github.com/JDAI-CV/fast-reid/blob/HEAD/fastreid/modeling/backbones/vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"75f5c156267fccbd"}},{"code_sha256_prefix":"719c7757b5d6beae","entry":"HybridEmbed","repo":"JDAI-CV/fast-reid","repo_kind":"found_in_text","path":"fastreid/modeling/backbones/vision_transformer.py","file_url":"https://github.com/JDAI-CV/fast-reid/blob/HEAD/fastreid/modeling/backbones/vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"719c7757b5d6beae"}},{"code_sha256_prefix":"9cd956aee362b467","entry":"PatchEmbed_overlap","repo":"JDAI-CV/fast-reid","repo_kind":"found_in_text","path":"fastreid/modeling/backbones/vision_transformer.py","file_url":"https://github.com/JDAI-CV/fast-reid/blob/HEAD/fastreid/modeling/backbones/vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9cd956aee362b467"}},{"code_sha256_prefix":"700a80fe0d60b57f","entry":"TransformerDecoderLayer","repo":"shengcailiao/QAConv","repo_kind":"official","path":"projects/transmatcher/transmatcher.py","file_url":"https://github.com/shengcailiao/QAConv/blob/HEAD/projects/transmatcher/transmatcher.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"700a80fe0d60b57f"}},{"code_sha256_prefix":"28e208cc3e5212ed","entry":"TransformerDecoderLayer","repo":"ShengcaiLiao/TransMatcher","repo_kind":"official","path":"matching/transmatcher_match.py","file_url":"https://github.com/ShengcaiLiao/TransMatcher/blob/HEAD/matching/transmatcher_match.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"28e208cc3e5212ed"}},{"code_sha256_prefix":"813ed3a96c17cf42","entry":"_no_grad_trunc_normal_","repo":"JDAI-CV/fast-reid","repo_kind":"found_in_text","path":"fastreid/modeling/backbones/vision_transformer.py","file_url":"https://github.com/JDAI-CV/fast-reid/blob/HEAD/fastreid/modeling/backbones/vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"813ed3a96c17cf42"}},{"code_sha256_prefix":"019554bbb3a9809d","entry":"_ntuple","repo":"JDAI-CV/fast-reid","repo_kind":"found_in_text","path":"fastreid/modeling/backbones/vision_transformer.py","file_url":"https://github.com/JDAI-CV/fast-reid/blob/HEAD/fastreid/modeling/backbones/vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"019554bbb3a9809d"}},{"code_sha256_prefix":"3ac6b7d76e8e3584","entry":"drop_path","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"3ac6b7d76e8e3584"}},{"code_sha256_prefix":"605878f6dcef72e9","entry":"trunc_normal_","repo":"JDAI-CV/fast-reid","repo_kind":"found_in_text","path":"fastreid/modeling/backbones/vision_transformer.py","file_url":"https://github.com/JDAI-CV/fast-reid/blob/HEAD/fastreid/modeling/backbones/vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"605878f6dcef72e9"}},{"code_sha256_prefix":"7632194fce63925e","entry":"TLift","repo":"ShengcaiLiao/QAConv","repo_kind":"official","path":"reid/tlift.py","file_url":"https://github.com/ShengcaiLiao/QAConv/blob/HEAD/reid/tlift.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7632194fce63925e"}},{"code_sha256_prefix":"33abed14c194aba1","entry":"TransMatcher","repo":"shengcailiao/QAConv","repo_kind":"official","path":"projects/transmatcher/transmatcher.py","file_url":"https://github.com/shengcailiao/QAConv/blob/HEAD/projects/transmatcher/transmatcher.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"33abed14c194aba1"}},{"code_sha256_prefix":"d616a6fa60f095d2","entry":"TransMatcher","repo":"ShengcaiLiao/TransMatcher","repo_kind":"official","path":"matching/transmatcher_match.py","file_url":"https://github.com/ShengcaiLiao/TransMatcher/blob/HEAD/matching/transmatcher_match.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d616a6fa60f095d2"}},{"code_sha256_prefix":"9366a0f55adb1a1b","entry":"TransformerDecoder","repo":"shengcailiao/QAConv","repo_kind":"official","path":"projects/transmatcher/transmatcher.py","file_url":"https://github.com/shengcailiao/QAConv/blob/HEAD/projects/transmatcher/transmatcher.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9366a0f55adb1a1b"}},{"code_sha256_prefix":"a7701d0fcf35a63a","entry":"TransformerDecoder","repo":"ShengcaiLiao/TransMatcher","repo_kind":"official","path":"matching/transmatcher_match.py","file_url":"https://github.com/ShengcaiLiao/TransMatcher/blob/HEAD/matching/transmatcher_match.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a7701d0fcf35a63a"}},{"code_sha256_prefix":"9368e7f2101c9a30","entry":"VisionTransformer","repo":"JDAI-CV/fast-reid","repo_kind":"found_in_text","path":"fastreid/modeling/backbones/vision_transformer.py","file_url":"https://github.com/JDAI-CV/fast-reid/blob/HEAD/fastreid/modeling/backbones/vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9368e7f2101c9a30"}},{"code_sha256_prefix":"6a5b9f52cf3678a2","entry":"create","repo":"ShengcaiLiao/QAConv","repo_kind":"official","path":"reid/models/resmap.py","file_url":"https://github.com/ShengcaiLiao/QAConv/blob/HEAD/reid/models/resmap.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6a5b9f52cf3678a2"}},{"code_sha256_prefix":"10c6466fe43af640","entry":"create","repo":"ShengcaiLiao/QAConv","repo_kind":"official","path":"projects/transmatcher/restranmap.py","file_url":"https://github.com/ShengcaiLiao/QAConv/blob/HEAD/projects/transmatcher/restranmap.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"10c6466fe43af640"}},{"code_sha256_prefix":"124a181591c811ba","entry":"extract_cnn_feature","repo":"ShengcaiLiao/QAConv","repo_kind":"official","path":"reid/evaluators.py","file_url":"https://github.com/ShengcaiLiao/QAConv/blob/HEAD/reid/evaluators.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"124a181591c811ba"}},{"code_sha256_prefix":"31d7e2c3ae921a59","entry":"extract_features","repo":"ShengcaiLiao/QAConv","repo_kind":"official","path":"reid/evaluators.py","file_url":"https://github.com/ShengcaiLiao/QAConv/blob/HEAD/reid/evaluators.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"31d7e2c3ae921a59"}},{"code_sha256_prefix":"cf997e855309b9ea","entry":"pre_tlift","repo":"ShengcaiLiao/QAConv","repo_kind":"official","path":"reid/evaluators.py","file_url":"https://github.com/ShengcaiLiao/QAConv/blob/HEAD/reid/evaluators.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cf997e855309b9ea"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}