{"id":19187562,"url":"https://github.com/materight/understandable-protopnet","last_synced_at":"2026-06-22T05:30:20.187Z","repository":{"id":42175552,"uuid":"439334552","full_name":"materight/understandable-ProtoPNet","owner":"materight","description":"A study on the interpretability of the concepts learned by Prototypical Part Networks (ProtoPNets) on the CUB200-2011 and CelebAMask datasets.","archived":false,"fork":false,"pushed_at":"2023-03-04T19:59:55.000Z","size":1728,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-04T05:52:26.214Z","etag":null,"topics":["celeba","cub200","part-prototype-networks","prototypical-networks","xai"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/materight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-17T13:03:32.000Z","updated_at":"2022-08-09T20:06:50.000Z","dependencies_parsed_at":"2025-01-04T05:51:33.228Z","dependency_job_id":"0b351fc7-0105-4568-9d0a-88c04f6ec0a5","html_url":"https://github.com/materight/understandable-ProtoPNet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/materight%2Funderstandable-ProtoPNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/materight%2Funderstandable-ProtoPNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/materight%2Funderstandable-ProtoPNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/materight%2Funderstandable-ProtoPNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/materight","download_url":"https://codeload.github.com/materight/understandable-ProtoPNet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240263865,"owners_count":19773865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["celeba","cub200","part-prototype-networks","prototypical-networks","xai"],"created_at":"2024-11-09T11:19:34.521Z","updated_at":"2026-06-22T05:30:18.135Z","avatar_url":"https://github.com/materight.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ProtoPNet: Are Learned Concepts Understandable?\nA study on the interpretability of the concepts learned by [Prototypical Part Networks](https://arxiv.org/abs/1806.10574) (ProtoPNets). \n\nThis work exploits the part locations annotations available for two different datasets to provide an objective evalution of the prototypes. An additional *diversity regularization* is also introduced to produce more diverse concepts. \n\nMore details on the implementation can be found in the [report](report.pdf).\n\n\u003ctable\u003e\n    \u003ctr align=\"center\"\u003e\n        \u003ctd valign=\"top\"\u003e\n            \u003cdiv\u003e\u003ci\u003eCalifornia Gull\u003c/i\u003e class\u003cdiv\u003e\n            \u003cimg src=\"img/cub200/alignment_matrix_prototypes.png\" width=\"100%\"\u003e\n            \u003cbr/\u003e\n            \u003cimg src=\"img/cub200/1_prototype_580_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cimg src=\"img/cub200/4_prototype_583_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cimg src=\"img/cub200/6_prototype_585_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cimg src=\"img/cub200/8_prototype_587_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cimg src=\"img/cub200/9_prototype_588_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cbr/\u003e\n                             \u003csup\u003e580\u003c/sup\u003e\u003cimg width=\"6.5%\"/\u003e\n            \u003cimg width=\"6.5%\"/\u003e\u003csup\u003e583\u003c/sup\u003e\u003cimg width=\"6.5%\"/\u003e\n            \u003cimg width=\"6.5%\"/\u003e\u003csup\u003e585\u003c/sup\u003e\u003cimg width=\"6.5%\"/\u003e\n            \u003cimg width=\"6.5%\"/\u003e\u003csup\u003e587\u003c/sup\u003e\u003cimg width=\"6.5%\"/\u003e\n            \u003cimg width=\"6.5%\"/\u003e\u003csup\u003e588\u003c/sup\u003e\n        \u003c/td\u003e\n        \u003ctd valign=\"top\"\u003e\n            \u003cdiv\u003e\u003ci\u003eFemale\u003c/i\u003e class\u003cdiv\u003e\n            \u003cimg src=\"img/celeb_a/alignment_matrix_prototypes.png\" width=\"100%\"\u003e\n            \u003cbr/\u003e\n            \u003cimg src=\"img/celeb_a/prototype_2_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cimg src=\"img/celeb_a/prototype_3_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cimg src=\"img/celeb_a/prototype_4_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cimg src=\"img/celeb_a/prototype_6_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cimg src=\"img/celeb_a/prototype_7_bbox.jpg\" width=\"18%\"/\u003e\n            \u003cbr/\u003e\n                             \u003csup\u003e2\u003c/sup\u003e\u003cimg width=\"8%\"/\u003e\n            \u003cimg width=\"8%\"/\u003e\u003csup\u003e3\u003c/sup\u003e\u003cimg width=\"8%\"/\u003e\n            \u003cimg width=\"8%\"/\u003e\u003csup\u003e4\u003c/sup\u003e\u003cimg width=\"8%\"/\u003e\n            \u003cimg width=\"8%\"/\u003e\u003csup\u003e6\u003c/sup\u003e\u003cimg width=\"8%\"/\u003e\n            \u003cimg width=\"8%\"/\u003e\u003csup\u003e7\u003c/sup\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n\n## Get started\n- Clone the repository and install the required dependencies:\n    ```shell\n    git clone https://github.com/materight/explainable-ProtoPNet.git\n    cd explainable-ProtoPNet\n    pip install -r requirements.txt\n    ```\n- Download and prepare the data, either for the [Caltech-UCSD Birds-200](http://www.vision.caltech.edu/datasets/cub_200_2011/) or the [CelebAMask HQ](http://mmlab.ie.cuhk.edu.hk/projects/CelebA/CelebAMask_HQ.html) datasets:\n    ```shell\n    python prepare_data.py cub200\n    python prepare_data.py celeb_a\n    ```\n\n## Train a model\nTo train a new model on a dataset, run:\n```shell\npython train.py --dataset [data_path] --exp_name [experiment_name]\n```\nAdditional options can be specified (run the script with `--help` to see the available ones).\n\nAfter training, the learned prototypes can be further pruned:\n```shell\npython prune_prototypes.py --dataset [data_path] --model [model_path]\n```\n\n## Evaluate learned prototypes\nTo evaluate a trained model and the learned prototypes, run:\n```shell\npython evaluate.py --model [model_path] {global|local|alignment} --dataset [data_path] \n```\n- `global`: retrieve for each prototype the most activated patches in the whole dataset.\n- `local`: evaluate the model on a subset of samples and generate visualizations for the activated prototypes for each class.\n- `alignment`: generate plots for the alignment matrix of each class.\n\n## Acknowledgments\nThis implementation is based on the original [ProtoPNet](https://github.com/cfchen-duke/ProtoPNet) repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateright%2Funderstandable-protopnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmateright%2Funderstandable-protopnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateright%2Funderstandable-protopnet/lists"}