{"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/abstracting-sketches-through-simple","title":"Abstracting Sketches through Simple Primitives","arxiv_id":"2207.13543","date":"2022-07-27","proceeding":null,"authors":["Stephan Alaniz","Massimiliano Mancini","Anjan Dutta","Diego Marcos","Zeynep Akata"],"abstract":"Humans show high-level of abstraction capabilities in games that require quickly communicating object information. They decompose the message content into multiple parts and communicate them in an interpretable protocol. Toward equipping machines with such capabilities, we propose the Primitive-based Sketch Abstraction task where the goal is to represent sketches using a fixed set of drawing primitives under the influence of a budget. To solve this task, our Primitive-Matching Network (PMN), learns interpretable abstractions of a sketch in a self supervised manner. Specifically, PMN maps each stroke of a sketch to its most similar primitive in a given set, predicting an affine transformation that aligns the selected primitive to the target stroke. We learn this stroke-to-primitive mapping end-to-end with a distance-transform loss that is minimal when the original sketch is precisely reconstructed with the predicted primitives. Our PMN abstraction empirically achieves the highest performance on sketch recognition and sketch-based image retrieval given a communication budget, while at the same time being highly interpretable. This opens up new possibilities for sketch analysis, such as comparing sketches by extracting the most relevant primitives that define an object category. Code is available at https://github.com/ExplainableML/sketch-primitives.","url_abs":"https://arxiv.org/abs/2207.13543v1","url_pdf":"https://arxiv.org/pdf/2207.13543v1.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":"abstracting-sketches-through-simple","repo_url":"https://github.com/explainableml/sketch-primitives","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-retrieval","task_name":"Image Retrieval"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"sketch-recognition","task_name":"Sketch Recognition"},{"task_slug":"sketch-based-image-retrieval","task_name":"Sketch-Based Image Retrieval"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2207.13543","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2207.13543"}},"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/ExplainableML/sketch-primitives","reach":null}],"summary":{"ran":2,"ran_fixture":1,"ran_honours":4,"ran_draft_wrong":3,"unverified":6},"by_repo_kind":{"official":{"samples":16,"ran":10,"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":16,"samples":[{"code_sha256_prefix":"49806d7067b3cfae","entry":"CosSin","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"49806d7067b3cfae"}},{"code_sha256_prefix":"f63434ed5d05bc15","entry":"ToTransformMatrix","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"f63434ed5d05bc15"}},{"code_sha256_prefix":"6b43707ef93388b4","entry":"add_edge_points","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"6b43707ef93388b4"}},{"code_sha256_prefix":"d677a26227562f6e","entry":"create_circle","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"d677a26227562f6e"}},{"code_sha256_prefix":"6a02a713c1820b6c","entry":"get_predefined_primitives","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"6a02a713c1820b6c"}},{"code_sha256_prefix":"1efdc349c7c6382a","entry":"get_stroke_stats","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"1efdc349c7c6382a"}},{"code_sha256_prefix":"ee9dab01bcaefa73","entry":"make_coordinate_grid","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"ee9dab01bcaefa73"}},{"code_sha256_prefix":"9dba125355868565","entry":"normalize_strokes","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"9dba125355868565"}},{"code_sha256_prefix":"86ce6f4ab51d3588","entry":"resample_data","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"86ce6f4ab51d3588"}},{"code_sha256_prefix":"3b617e32a6e5d607","entry":"resample_stroke","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"3b617e32a6e5d607"}},{"code_sha256_prefix":"a2bbd4dfe8393eb0","entry":"PrimitiveMatchingNetwork","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"a2bbd4dfe8393eb0"}},{"code_sha256_prefix":"f110411cc2463e48","entry":"StrokeEncoderTransformer","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"f110411cc2463e48"}},{"code_sha256_prefix":"9b289f32881a03e8","entry":"compute_distance_transform_l2","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"9b289f32881a03e8"}},{"code_sha256_prefix":"8f1b8113eb301e09","entry":"compute_full_transformation","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"8f1b8113eb301e09"}},{"code_sha256_prefix":"26cebe63a9b94426","entry":"distance_transform","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"26cebe63a9b94426"}},{"code_sha256_prefix":"126d5b926144bff2","entry":"transform_primitives","repo":"ExplainableML/sketch-primitives","repo_kind":"official","path":"models/pmn.py","file_url":"https://github.com/ExplainableML/sketch-primitives/blob/HEAD/models/pmn.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"126d5b926144bff2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}