{"id":29698720,"url":"https://github.com/eidoslab/pruning-for-vision-representation","last_synced_at":"2025-07-23T10:38:28.127Z","repository":{"id":302453864,"uuid":"1012497963","full_name":"EIDOSLAB/pruning-for-vision-representation","owner":"EIDOSLAB","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-02T12:40:13.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-02T13:44:49.517Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/EIDOSLAB.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,"zenodo":null}},"created_at":"2025-07-02T12:27:20.000Z","updated_at":"2025-07-02T12:40:17.000Z","dependencies_parsed_at":"2025-07-02T13:44:51.646Z","dependency_job_id":"ee02e649-fd8a-44b5-892a-88c0afcde064","html_url":"https://github.com/EIDOSLAB/pruning-for-vision-representation","commit_stats":null,"previous_names":["eidoslab/pruning-for-vision-representation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EIDOSLAB/pruning-for-vision-representation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fpruning-for-vision-representation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fpruning-for-vision-representation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fpruning-for-vision-representation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fpruning-for-vision-representation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EIDOSLAB","download_url":"https://codeload.github.com/EIDOSLAB/pruning-for-vision-representation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EIDOSLAB%2Fpruning-for-vision-representation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266664242,"owners_count":23964930,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-07-23T10:38:27.544Z","updated_at":"2025-07-23T10:38:28.107Z","avatar_url":"https://github.com/EIDOSLAB.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pruning for Vision Representation\n\nThis repository provides code and tools for research on **pruning neural networks for vision representation tasks**, including classification, object detection, and segmentation. The project leverages PyTorch and TorchVision, and supports various models such as ResNet and ViT (Vision Transformers).\n\n## Features\n\n- **Support for Multiple Architectures**: Different versions of ResNet and ViT.\n- **Training \u0026 Evaluation**: End-to-end scripts for training pruned models and evaluating them on standard vision benchmarks (e.g., ImageNet, VOC, COCO).\n- **Visualization \u0026 Analysis**: Utilities for comparing model vs. human performance, saving high-quality plots, and analyzing learned representations.\n- **Explainability**: Some explainability techniques implemented in this repository are taken from the [Captum library](https://captum.ai/).\n\n## News\n\n- 📄 The corresponding paper has been **accepted at ICIAP 2025**.\n\n## Getting Started\n\n### Requirements\n\n- Python 3.8+\n- PyTorch (\u003e=1.10)\n- TorchVision\n- numpy, matplotlib, opencv-python, Pillow, and other standard ML libraries\n\n### Datasets\n\nPrepare your datasets (e.g., ImageNet, VOC, COCO) and organize them as follows:\n\n```\nyour_data_path/\n    train/\n    val/\n```\nUpdate dataset paths in your scripts as needed.\n\n## Usage\n\n### Training a Pruned Model\n\nExample for ImageNet:\n\n```bash\npython train.py --model resnet18 --data-path /path/to/imagenet --pruning-method snip --target-sparsity 0.5 --epochs 90 --output-dir ./results\n```\n\n### Running Object Discovery (LOST)\n\n```bash\npython main_lost.py --arch vit_small --dataset VOC07 --set train --models-dir /path/to/models --data-path /path/to/data\n```\n\n### Visualization\n\nScripts such as `mvh_triple_comparison.py` and `mvh_performance_rn50_vs_rn18.py` generate high-quality performance comparison plots.\n\n## Repository Structure\n\n- `train.py` — Training loop with support for pruning and logging.\n- `main_lost.py` — Object discovery with LOST.\n- `explain.py` — Explanation and analysis tools (with techniques from [Captum](https://captum.ai/)).\n- `utils.py` — Utilities for model export, reproducibility, and more.\n- `datasets.py` — Dataset loading and handling.\n- `cluster_for_OD.py`, `mvh_triple_comparison.py`, etc. — Additional experiments and analyses.\n\n## 📚 Bibtex\n```bibtex\n@misc{cassano2025doespruningbenefitvision,\n      title={When Does Pruning Benefit Vision Representations?}, \n      author={Enrico Cassano and Riccardo Renzulli and Andrea Bragagnolo and Marco Grangetto},\n      year={2025},\n      eprint={2507.01722},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV},\n      url={https://arxiv.org/abs/2507.01722}, \n}\n```\n\n## Acknowledgements\n\n- Some explainability techniques are taken from the [Captum library](https://captum.ai/).\n- This code builds on top of PyTorch and TorchVision libraries. If you use this repository for your research, please consider citing the relevant papers and this repository.\n\n## License\n\nThis project is for research purposes. See individual file headers for license information.\n\n---\n\n**Maintained by [EIDOSLAB](https://eidos.di.unito.it/).**  \nFor questions or contributions, please open an issue or pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feidoslab%2Fpruning-for-vision-representation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feidoslab%2Fpruning-for-vision-representation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feidoslab%2Fpruning-for-vision-representation/lists"}