{"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/attribute-surrogates-learning-and-spectral","title":"Attribute Surrogates Learning and Spectral Tokens Pooling in Transformers for Few-shot Learning","arxiv_id":"2203.09064","date":"2022-03-17","proceeding":"CVPR 2022 1","authors":["Yangji He","Weihan Liang","Dongyang Zhao","Hong-Yu Zhou","Weifeng Ge","Yizhou Yu","Wenqiang Zhang"],"abstract":"This paper presents new hierarchically cascaded transformers that can improve data efficiency through attribute surrogates learning and spectral tokens pooling. Vision transformers have recently been thought of as a promising alternative to convolutional neural networks for visual recognition. But when there is no sufficient data, it gets stuck in overfitting and shows inferior performance. To improve data efficiency, we propose hierarchically cascaded transformers that exploit intrinsic image structures through spectral tokens pooling and optimize the learnable parameters through latent attribute surrogates. The intrinsic image structure is utilized to reduce the ambiguity between foreground content and background noise by spectral tokens pooling. And the attribute surrogate learning scheme is designed to benefit from the rich visual information in image-label pairs instead of simple visual concepts assigned by their labels. Our Hierarchically Cascaded Transformers, called HCTransformers, is built upon a self-supervised learning framework DINO and is tested on several popular few-shot learning benchmarks. In the inductive setting, HCTransformers surpass the DINO baseline by a large margin of 9.7% 5-way 1-shot accuracy and 9.17% 5-way 5-shot accuracy on miniImageNet, which demonstrates HCTransformers are efficient to extract discriminative features. Also, HCTransformers show clear advantages over SOTA few-shot classification methods in both 5-way 1-shot and 5-way 5-shot settings on four popular benchmark datasets, including miniImageNet, tieredImageNet, FC100, and CIFAR-FS. The trained weights and codes are available at https://github.com/StomachCold/HCTransformers.","url_abs":"https://arxiv.org/abs/2203.09064v1","url_pdf":"https://arxiv.org/pdf/2203.09064v1.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":"attribute-surrogates-learning-and-spectral","repo_url":"https://github.com/stomachcold/hctransformers","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"attribute","task_name":"Attribute"},{"task_slug":"few-shot-image-classification","task_name":"Few-Shot Image Classification"},{"task_slug":"few-shot-learning","task_name":"Few-Shot Learning"},{"task_slug":"self-supervised-learning","task_name":"Self-Supervised Learning"}],"methods":[{"method_slug":"attention","method_name":"Attention"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"vision-transformer","method_name":"Vision Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/few-shot-image-classification-on-cifar-fs-5","task":"Few-Shot Image Classification","dataset":"CIFAR-FS 5-way (1-shot)","model":"HCTransformers","rank_in_archive_order":14,"of":38,"metrics":{"Accuracy":"78.89"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-cifar-fs-5-1","task":"Few-Shot Image Classification","dataset":"CIFAR-FS 5-way (5-shot)","model":"HCTransformers","rank_in_archive_order":10,"of":39,"metrics":{"Accuracy":"90.50"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-fc100-5-way","task":"Few-Shot Image Classification","dataset":"FC100 5-way (1-shot)","model":"HCTransformers","rank_in_archive_order":7,"of":22,"metrics":{"Accuracy":"48.27"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-fc100-5-way-1","task":"Few-Shot Image Classification","dataset":"FC100 5-way (5-shot)","model":"HCTransformers","rank_in_archive_order":6,"of":22,"metrics":{"Accuracy":"66.42"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-mini-2","task":"Few-Shot Image Classification","dataset":"Mini-Imagenet 5-way (1-shot)","model":"HCTransformers","rank_in_archive_order":24,"of":105,"metrics":{"Accuracy":"74.74"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-mini-3","task":"Few-Shot Image Classification","dataset":"Mini-Imagenet 5-way (5-shot)","model":"HCTransformers","rank_in_archive_order":12,"of":95,"metrics":{"Accuracy":"89.19"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-tiered","task":"Few-Shot Image Classification","dataset":"Tiered ImageNet 5-way (1-shot)","model":"HCTransformers","rank_in_archive_order":13,"of":49,"metrics":{"Accuracy":"79.67"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-image-classification-on-tiered-1","task":"Few-Shot Image Classification","dataset":"Tiered ImageNet 5-way (5-shot)","model":"HCTransformers","rank_in_archive_order":3,"of":51,"metrics":{"Accuracy":"91.72"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-learning-on-mini-imagenet-1-shot-2","task":"Few-Shot Learning","dataset":"Mini-ImageNet - 1-Shot Learning","model":"HCTransformers","rank_in_archive_order":1,"of":2,"metrics":{"Acc":"74.74"},"uses_additional_data":false},{"leaderboard":"/sota/few-shot-learning-on-mini-imagenet-5-way-1","task":"Few-Shot Learning","dataset":"Mini-Imagenet 5-way (1-shot)","model":"HCTransformers","rank_in_archive_order":3,"of":3,"metrics":{"5 way 1~2 shot":"74.74"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2203.09064","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2203.09064"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/stomachcold/hctransformers","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/StomachCold/HCTransformers","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":1,"ran_honours":1,"ran_fixture":1,"ran_draft_wrong":1,"unverified":1},"by_repo_kind":{"official":{"samples":5,"ran":4,"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":0,"samples":[{"code_sha256_prefix":"c5d1a05832204fff","entry":"MultiKMeans","repo":"StomachCold/HCTransformers","repo_kind":"official","path":"spectral_cluster.py","file_url":"https://github.com/StomachCold/HCTransformers/blob/HEAD/spectral_cluster.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c5d1a05832204fff"}},{"code_sha256_prefix":"f454fd53689fe3d8","entry":"get_neighbor_mask_old","repo":"StomachCold/HCTransformers","repo_kind":"official","path":"spectral_cluster.py","file_url":"https://github.com/StomachCold/HCTransformers/blob/HEAD/spectral_cluster.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f454fd53689fe3d8"}},{"code_sha256_prefix":"2889c1d335446de7","entry":"graph_laplacian","repo":"StomachCold/HCTransformers","repo_kind":"official","path":"spectral_cluster.py","file_url":"https://github.com/StomachCold/HCTransformers/blob/HEAD/spectral_cluster.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2889c1d335446de7"}},{"code_sha256_prefix":"e13665dd67f83791","entry":"neighbor_mask_reduce","repo":"StomachCold/HCTransformers","repo_kind":"official","path":"spectral_cluster.py","file_url":"https://github.com/StomachCold/HCTransformers/blob/HEAD/spectral_cluster.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e13665dd67f83791"}},{"code_sha256_prefix":"24ff42dbb948bdad","entry":"spectral_cluster","repo":"StomachCold/HCTransformers","repo_kind":"official","path":"spectral_cluster.py","file_url":"https://github.com/StomachCold/HCTransformers/blob/HEAD/spectral_cluster.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":"24ff42dbb948bdad"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}