{"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/matteformer-transformer-based-image-matting","title":"MatteFormer: Transformer-Based Image Matting via Prior-Tokens","arxiv_id":"2203.15662","date":"2022-03-29","proceeding":"CVPR 2022 1","authors":["Gyutae Park","Sungjoon Son","Jaeyoung Yoo","SeHo Kim","Nojun Kwak"],"abstract":"In this paper, we propose a transformer-based image matting model called MatteFormer, which takes full advantage of trimap information in the transformer block. Our method first introduces a prior-token which is a global representation of each trimap region (e.g. foreground, background and unknown). These prior-tokens are used as global priors and participate in the self-attention mechanism of each block. Each stage of the encoder is composed of PAST (Prior-Attentive Swin Transformer) block, which is based on the Swin Transformer block, but differs in a couple of aspects: 1) It has PA-WSA (Prior-Attentive Window Self-Attention) layer, performing self-attention not only with spatial-tokens but also with prior-tokens. 2) It has prior-memory which saves prior-tokens accumulatively from the previous blocks and transfers them to the next block. We evaluate our MatteFormer on the commonly used image matting datasets: Composition-1k and Distinctions-646. Experiment results show that our proposed method achieves state-of-the-art performance with a large margin. Our codes are available at https://github.com/webtoon/matteformer.","url_abs":"https://arxiv.org/abs/2203.15662v1","url_pdf":"https://arxiv.org/pdf/2203.15662v1.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":"matteformer-transformer-based-image-matting","repo_url":"https://github.com/webtoon/matteformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-matting","task_name":"Image Matting"}],"methods":[{"method_slug":"attention","method_name":"Attention"},{"method_slug":"swin-transformer","method_name":"Swin Transformer"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/image-matting-on-composition-1k-1","task":"Image Matting","dataset":"Composition-1K","model":"MatteFormer","rank_in_archive_order":5,"of":13,"metrics":{"Conn":"18.9","Grad":"8.7","MSE":"4.0","SAD":"23.8"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2203.15662","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2203.15662"}},"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/webtoon/matteformer","reach":null}],"summary":{"ran":3,"ran_draft_wrong":1,"ran_fixture":1,"unverified":3},"by_repo_kind":{"official":{"samples":7,"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":1,"samples":[{"code_sha256_prefix":"be3f1570f7ddf136","entry":"PAWSA","repo":"webtoon/matteformer","repo_kind":"official","path":"networks/encoders/MatteFormer.py","file_url":"https://github.com/webtoon/matteformer/blob/HEAD/networks/encoders/MatteFormer.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":"be3f1570f7ddf136"}},{"code_sha256_prefix":"129c03641741d697","entry":"PatchEmbed","repo":"webtoon/matteformer","repo_kind":"official","path":"networks/encoders/MatteFormer.py","file_url":"https://github.com/webtoon/matteformer/blob/HEAD/networks/encoders/MatteFormer.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":"129c03641741d697"}},{"code_sha256_prefix":"e489b0e620c2827e","entry":"SpectralNorm","repo":"webtoon/matteformer","repo_kind":"official","path":"networks/encoders/MatteFormer.py","file_url":"https://github.com/webtoon/matteformer/blob/HEAD/networks/encoders/MatteFormer.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":"e489b0e620c2827e"}},{"code_sha256_prefix":"bedff51745d2cf84","entry":"l2normalize","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"bedff51745d2cf84"}},{"code_sha256_prefix":"93033d45b73cce18","entry":"window_partition","repo":"webtoon/matteformer","repo_kind":"official","path":"networks/encoders/MatteFormer.py","file_url":"https://github.com/webtoon/matteformer/blob/HEAD/networks/encoders/MatteFormer.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"93033d45b73cce18"}},{"code_sha256_prefix":"0ff17c6f3aabd80e","entry":"BasicLayer","repo":"webtoon/matteformer","repo_kind":"official","path":"networks/encoders/MatteFormer.py","file_url":"https://github.com/webtoon/matteformer/blob/HEAD/networks/encoders/MatteFormer.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":"0ff17c6f3aabd80e"}},{"code_sha256_prefix":"af540816b46af375","entry":"MatteFormer","repo":"webtoon/matteformer","repo_kind":"official","path":"networks/encoders/MatteFormer.py","file_url":"https://github.com/webtoon/matteformer/blob/HEAD/networks/encoders/MatteFormer.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":"af540816b46af375"}},{"code_sha256_prefix":"42d0760afaf8ab98","entry":"PASTBlock","repo":"webtoon/matteformer","repo_kind":"official","path":"networks/encoders/MatteFormer.py","file_url":"https://github.com/webtoon/matteformer/blob/HEAD/networks/encoders/MatteFormer.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":"42d0760afaf8ab98"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}