{"id":13576274,"url":"https://github.com/NJUyued/SoC4SS-FGVC","last_synced_at":"2025-04-05T05:31:21.527Z","repository":{"id":212519998,"uuid":"564796650","full_name":"NJUyued/SoC4SS-FGVC","owner":"NJUyued","description":"\"Roll with the Punches: Expansion and Shrinkage of Soft Label Selection for Semi-supervised Fine-Grained Learning\" by Yue Duan (AAAI 2024)","archived":false,"fork":false,"pushed_at":"2024-11-26T16:27:51.000Z","size":125,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-26T17:28:54.396Z","etag":null,"topics":["aaai2024","computer-vision","fine-grained-classification","fine-grained-visual-categorization","machine-learning","semi-supervised-classification","semi-supervised-learning","torch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NJUyued.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-11-11T14:17:12.000Z","updated_at":"2024-11-26T16:27:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a0ec6a2-d7bd-4c21-b2f0-c07b803d6c14","html_url":"https://github.com/NJUyued/SoC4SS-FGVC","commit_stats":null,"previous_names":["njuyued/soc4ss-fgvc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NJUyued%2FSoC4SS-FGVC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NJUyued%2FSoC4SS-FGVC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NJUyued%2FSoC4SS-FGVC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NJUyued%2FSoC4SS-FGVC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NJUyued","download_url":"https://codeload.github.com/NJUyued/SoC4SS-FGVC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294275,"owners_count":20915333,"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":["aaai2024","computer-vision","fine-grained-classification","fine-grained-visual-categorization","machine-learning","semi-supervised-classification","semi-supervised-learning","torch"],"created_at":"2024-08-01T15:01:08.733Z","updated_at":"2025-04-05T05:31:16.508Z","avatar_url":"https://github.com/NJUyued.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# SoC4SS-FGVC\n\nThis repo is the official Pytorch implementation of our paper:\n\n\u003e **Roll with the Punches: Expansion and Shrinkage of Soft Label Selection for Semi-supervised Fine-Grained Learning**  \n\u003e **Authors**: ***[Yue Duan](https://njuyued.github.io/)**, Zhen Zhao, Lei Qi, Luping Zhou, Lei Wang and Yinghuan Shi* \n \n- 🔗 **Quick links:** [[PDF](https://arxiv.org/pdf/2312.12237)/[Abs](https://arxiv.org/abs/2312.12237)-arXiv | [PDF](https://ojs.aaai.org/index.php/AAAI/article/view/29068/30023)/[Abs](https://ojs.aaai.org/index.php/AAAI/article/view/29068)-Published | [Poster/Slides](https://github.com/NJUyued/Posters-Slides-Videos/tree/master/SoC-AAAI'24) | [Video](https://ojs.aaai.org/index.php/AAAI/article/view/29068/30024) | [Code Download](https://github.com/NJUyued/SoC4SS-FGVC/archive/refs/heads/master.zip)]\n \n - 📰 **Latest news:**\n     - **[Slides](https://github.com/NJUyued/Posters-Slides-Videos/tree/master/SoC-AAAI'24) and [video](https://ojs.aaai.org/index.php/AAAI/article/view/29068/30024) explaining our paper are now online!**\n     - Our paper is accepted by **AAAI Conference on Artificial Intelligence (AAAI) 2024** 🎉🎉. Thanks to users.\n - 📑 **Related works:**\n     - Interested in **robust SSL in MNAR setting** with mismatched distributions? 👉 Check out our ICCV'23 paper **PRG** [[PDF-arXiv](https://arxiv.org/abs/2308.08872) | [Code](https://github.com/NJUyued/PRG4SSL-MNAR)] or our ECCV'22 paper **RDA** [[PDF-arXiv](https://arxiv.org/pdf/2208.04619) | [Code](https://github.com/NJUyued/RDA4RobustSSL)].\n     - Interested in the conventional SSL or application of **complementary label in SSL**? 👉 Check out our TNNLS paper **MutexMatch** [[PDF-arXiv](https://arxiv.org/pdf/2203.14316) | [Code](https://github.com/NJUyued/MutexMatch4SSL/)].\n## Requirements\n\n- numpy==1.20.3\n- Pillow==9.3.0\n- scikit_learn==1.1.3\n- torch==1.8.0\n- torchvision==0.9.0\n\n\n## How to Train\n### Important Args\n- `--net [resnet18/resnet50/resnet101/wrn/wrnvar/preresnet/cnn13]`: By default, ResNet-50 is used for experiments.  We provide alternatives as follows: ResNet-18/101, Wide ResNet, Wide ResNet-Var (WRN-37-2), PreAct ResNet and CNN-13.\n- `--dataset [semi-fungi/semi-aves]` and `--data_dir`: Your dataset name and path. We support two datasets: Semi-Fungi and Semi-Aves (See \"*A Realistic Evaluation of Semi-Supervised Learning for Fine-Grained Classification*\" for details).\n- `--unlabel [in/inout]`: The unlabeled data used for training. The unlabeled data of Semi-Fungi and Semi-Aves contains two subsets. One has in-distribution data only, the other one has both in-distribution and out-of-distribution data.\n- `--alpha`: $\\alpha$ for confidence-aware k selection.\n- `--num_tracked_batch`: $N_{B}$ for class transition tracking (CTT).\n- `--resume`, `--load_path`, `--load_path_soc` and `--pretrained`: \n    - If you want to resume training without `soc.pkl`, i.e., saved data of `centroids` (for CTT-based k-means clustering) and `label_matrix` (for CTT), please set `--resume --load_path @path to your checkpoint@`. \n    - If you want to resume training with `soc.pkl`, please set `--resume --load_path @path to your checkpoint@ --load_path_soc @path to your soc.pkl@`. \n    - If you want to use the expert model or MoCo model, please set `--resume --load_path @path to expert model/MoCo model@ --pretrained`.\n\n### Training with Single GPU\n\n```\npython train_soc.py --rank 0 --gpu [0/1/...] @@@other args@@@\n```\n### Training with Multi-GPUs\n\n- Using DataParallel\n\n```\npython train_soc.py --world-size 1 --rank 0 @@@other args@@@\n```\n\n- Using DistributedDataParallel with single node\n\n```\npython train_soc.py --world-size 1 --rank 0 --multiprocessing-distributed @@@other args@@@\n```\n\n## Examples of Running\n\nTo better reproduce our experimental results, it is recommended to use multi-GPUs with DataParallel for training.\n\n### Using In-distribuion Unlabeleda Data \n#### Training from scratch\n\n```\npython train_soc.py --world-size 1 --rank 0 --seed 1 --num_eval_iter 2000 --overwrite --save_name aves_in_sc --dataset semi_aves --num_classes 200 --unlabel in \n```\n\n#### Training from scratch with MoCo\n\n```\npython train_soc.py --world-size 1 --rank 0 --seed 1 --num_eval_iter 1000 --overwrite --save_name aves_in_sc_moco --dataset semi_aves --num_classes 200 --unlabel in --resume --load_path @path to MoCo pre-trained model@ --pretrained --num_train_iter 200000\n```\n\n#### Training from expert or expert with MoCo\n\n```\npython train_soc.py --world-size 1 --rank 0 --seed 1 --num_eval_iter 500 --overwrite --save_name aves_in_pre --dataset semi_aves --num_classes 200 --unlabel in --resume --load_path @path to pre-trained model@ --pretrained --lr 0.001 --num_train_iter 50000\n```\n\n\nThe expert models and MoCo models can be obtained [here][ck] (provided by https://github.com/cvl-umass/ssl-evaluation).\n\n\n### Using Out-of-Distribuion Unlabeleda Data \n#### Training from scratch\n\n```\npython train_soc.py --world-size 1 --rank 0 --seed 1 --num_eval_iter 2000 --overwrite --save_name aves_inout_sc --dataset semi_aves --num_classes 200 --unlabel inout \n```\n\n***\n## Evaluation\nEach time you start training, the evaluation results of the current model will be displayed. If you want to evaluate a model, use its checkpoints to resume training, i.e., use `--resume --load_path @path to your checkpoint@`.\n\n## Results (e.g. seed=1)\n\n| Dateset | Unlabeled Data | Pre-training | Top1-Acc (%)| Top5-Acc (%)| Checkpoint |\n| :-----:| :----: | :----: |:----: |:----: |:----: |\n|Semi-Aves | in-distribution | - | 32.3 | 55.5 | [here][av-in-sc] |\n| | | MoCo | 39.5 | 62.5 | [here][av-in-sc-mc] |\n| | | ImageNet | 56.8 | 79.1 | [here][av-in-im] |\n| | | ImageNet  + MoCo | 57.1 | 79.1 | [here][av-in-im-mc] |\n| | | iNat | 71.0 | 88.4 | [here][av-in-in] |\n| | | iNat + MoCo | 70.2 | 88.3 | [here][av-in-in-mc] |\n| | out-of-distribution | - | 27.5 | 50.7 | [here][av-inout-sc] |\n| |  | MoCo | 40.4 | 65.9 | [here][av-inout-sc-mc] |\n|Semi-Fungi | in-distribution | - | 38.50 | 61.35 | [here][fg-in-sc] |\n| | | MoCo | 46.9 | 71.4 | [here][fg-in-sc-mc] |\n| | | ImageNet | 61.1 | 83.2 | [here][fg-in-im] |\n| | | ImageNet  + MoCo | 61.8 | 85.9 | [here][fg-in-im-mc] |\n| | | iNat | 62.3 | 85.0 | [here][fg-in-in] |\n| | | iNat + MoCo | 62.2 | 84.4 | [here][fg-in-in-mc] |\n| | out-of-distribution | - | 35.6 | 60.6 | [here][fg-inout-sc] | \n| |  | MoCo | 50.0 | 74.8 | [here][fg-inout-sc-mc] |\n\n## Citaion\nPlease cite our paper if you find SoC useful:\n```\n@inproceedings{duan2024roll,\n  title={Roll with the Punches: Expansion and Shrinkage of Soft Label Selection for Semi-supervised Fine-Grained Learning},\n  author={Duan, Yue and Zhao, Zhen and Qi, Lei and Zhou, Luping and Wang, Lei and Shi, Yinghuan},\n  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},\n  volume={38},\n  number={10},\n  pages={11829--11837},\n  year={2024}\n}\n```\nor\n```\n@article{duan2023roll,\n  title={Roll With the Punches: Expansion and Shrinkage of Soft Label Selection for Semi-supervised Fine-Grained Learning},\n  author={Duan, Yue and Zhao, Zhen and Qi, Lei and Zhou, Luping and Wang, Lei and Shi, Yinghuan},\n  journal={arXiv preprint arXiv:2312.12237},\n  year={2023}\n}\n```\n\n\n[av-in-im]: https://drive.google.com/drive/folders/1apctbIN_O9EuD8ZXrr7Diwq-1z0qADBu?usp=share_link\n[av-in-im-mc]: https://drive.google.com/drive/folders/1lx-DYwCF1bDdGoy5nUQ_0Kdp6jhwQ_qi?usp=share_link\n[av-in-in]: https://drive.google.com/drive/folders/1C4RcpnSmWcwpbSpkAicbcdjx-7Su80Rb?usp=share_link\n[av-in-in-mc]: https://drive.google.com/drive/folders/1NC9HCB1sdbPhEd3SeStfrVQEBLTPKc_A?usp=share_link\n[av-in-sc]: https://drive.google.com/drive/folders/1ML3WJeH20achx5KxZQYGCVrRNCAfJl0Y?usp=share_link\n[av-in-sc-mc]: https://drive.google.com/drive/folders/1dyY-ylLI0op0-MiKFpYhfctTFp5iPUpJ?usp=share_link\n[av-inout-sc]: https://drive.google.com/drive/folders/105EDpTelNa7oURIV0TGpHKf2W80M32yN?usp=share_link\n[av-inout-sc-mc]: https://drive.google.com/drive/folders/1gy9KSXJ4OX3SKJtf8N9aritxP12atVkJ?usp=share_link\n[fg-in-im]: https://drive.google.com/drive/folders/1cn8QTJFJnDhlgR-vDHaJNM5_NaBQsbAB?usp=share_link\n[fg-in-im-mc]: https://drive.google.com/drive/folders/1Ug4C9qpTmL_H3760gTt0FfSpGPj6tpuS?usp=share_link\n[fg-in-in]: https://drive.google.com/drive/folders/1DygNzUCNc9BFhhK2rmy7JkRoOb-x2SNP?usp=share_link\n[fg-in-in-mc]: https://drive.google.com/drive/folders/13kvItyHZqZiL8AAViuU5Y46CpXMfPMSw?usp=share_link\n[fg-in-sc]: https://drive.google.com/drive/folders/15s-upb33Uo1_dpF9xLQSkvgu4MAsCBQA?usp=share_link\n[fg-in-sc-mc]: https://drive.google.com/drive/folders/1Sk5E9H5J8QaslyIxH2HilUWK8NEmiG-b?usp=share_link\n[fg-inout-sc]: https://drive.google.com/drive/folders/1EO8IHoO8TW9YhWKO-3bv9iCj2Mya0hXy?usp=share_link\n[fg-inout-sc-mc]: https://drive.google.com/drive/folders/1CW8QwusyAlF2kL6zT94lUgx5AIxgMSQg?usp=share_link\n[ck]: http://vis-www.cs.umass.edu/semi-inat-2021/ssl_evaluation/models/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNJUyued%2FSoC4SS-FGVC","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNJUyued%2FSoC4SS-FGVC","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNJUyued%2FSoC4SS-FGVC/lists"}