{"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/mvrec-a-general-few-shot-defect","title":"MVREC: A General Few-shot Defect Classification Model Using Multi-View Region-Context","arxiv_id":"2412.16897","date":"2024-12-22","proceeding":null,"authors":["Shuai Lyu","Rongchen Zhang","Zeqi Ma","Fangjian Liao","Dongmei Mo","Waikeung Wong"],"abstract":"Few-shot defect multi-classification (FSDMC) is an emerging trend in quality control within industrial manufacturing. However, current FSDMC research often lacks generalizability due to its focus on specific datasets. Additionally, defect classification heavily relies on contextual information within images, and existing methods fall short of effectively extracting this information. To address these challenges, we propose a general FSDMC framework called MVREC, which offers two primary advantages: (1) MVREC extracts general features for defect instances by incorporating the pre-trained AlphaCLIP model. (2) It utilizes a region-context framework to enhance defect features by leveraging mask region input and multi-view context augmentation. Furthermore, Few-shot Zip-Adapter(-F) classifiers within the model are introduced to cache the visual features of the support set and perform few-shot classification. We also introduce MVTec-FS, a new FSDMC benchmark based on MVTec AD, which includes 1228 defect images with instance-level mask annotations and 46 defect types. Extensive experiments conducted on MVTec-FS and four additional datasets demonstrate its effectiveness in general defect classification and its ability to incorporate contextual information to improve classification performance. Code: https://github.com/ShuaiLYU/MVREC","url_abs":"https://arxiv.org/abs/2412.16897v2","url_pdf":"https://arxiv.org/pdf/2412.16897v2.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":"mvrec-a-general-few-shot-defect","repo_url":"https://github.com/ShuaiLYU/MVREC","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"classification-1","task_name":"Classification"},{"task_slug":"few-shot-instance-classification","task_name":"Few-Shot Instance Classification"},{"task_slug":"few-shot-learning","task_name":"Few-Shot Learning"}],"methods":[{"method_slug":"clip","method_name":"CLIP"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2412.16897","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2412.16897"}},"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/ShuaiLYU/MVREC","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":12},"by_repo_kind":{"official":{"samples":12,"ran":0,"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":"e2a46cdcec8bbfc3","entry":"assemble_by_averge","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"fewshot_process.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/fewshot_process.py","link_basis":"harvester_set","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":"e2a46cdcec8bbfc3"}},{"code_sha256_prefix":"3b517ff8bfcec41b","entry":"calculate_mean_and_std","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"fewshot_process.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/fewshot_process.py","link_basis":"harvester_set","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":"3b517ff8bfcec41b"}},{"code_sha256_prefix":"9d6f9b4d8d3bdba1","entry":"calculate_uncertainty","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/torch_demo.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/torch_demo.py","link_basis":"harvester_set","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":"9d6f9b4d8d3bdba1"}},{"code_sha256_prefix":"4d3a685edeeebd86","entry":"compute_class_prototypes","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/classifier_base.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/classifier_base.py","link_basis":"harvester_set","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":"4d3a685edeeebd86"}},{"code_sha256_prefix":"e121bd8264c1da96","entry":"cosine_similarity_between_x_and_x0","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/classifier_base.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/classifier_base.py","link_basis":"harvester_set","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":"e121bd8264c1da96"}},{"code_sha256_prefix":"10fa3f3218177695","entry":"custom_collate_fn","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/multi_view_data.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/multi_view_data.py","link_basis":"harvester_set","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":"10fa3f3218177695"}},{"code_sha256_prefix":"66f992ab432f3840","entry":"log_execution_time","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/multi_view_data.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/multi_view_data.py","link_basis":"harvester_set","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":"66f992ab432f3840"}},{"code_sha256_prefix":"1c08e0efb7df0891","entry":"merge_first_two_dims","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/torch_demo.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/torch_demo.py","link_basis":"harvester_set","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":"1c08e0efb7df0891"}},{"code_sha256_prefix":"115bcc8b6b429af8","entry":"merge_second_third_dims","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/torch_demo.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/torch_demo.py","link_basis":"harvester_set","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":"115bcc8b6b429af8"}},{"code_sha256_prefix":"87750a04fba17894","entry":"random_bbox","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/utils.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/utils.py","link_basis":"harvester_set","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":"87750a04fba17894"}},{"code_sha256_prefix":"0350a0c33f0f4bd5","entry":"super_crop","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/utils.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/utils.py","link_basis":"harvester_set","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":"0350a0c33f0f4bd5"}},{"code_sha256_prefix":"5a56c5fda7fc328f","entry":"truncate_bbox","repo":"ShuaiLYU/MVREC","repo_kind":"official","path":"modules/utils.py","file_url":"https://github.com/ShuaiLYU/MVREC/blob/HEAD/modules/utils.py","link_basis":"harvester_set","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":"5a56c5fda7fc328f"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}