{"id":15676998,"url":"https://github.com/rishit-dagli/astroformer","last_synced_at":"2025-10-16T11:27:43.770Z","repository":{"id":205568140,"uuid":"714483962","full_name":"Rishit-dagli/Astroformer","owner":"Rishit-dagli","description":"This repository contains the official implementation of Astroformer, an ICLR Workshop 2023 paper.","archived":false,"fork":false,"pushed_at":"2023-11-05T06:52:52.000Z","size":2457,"stargazers_count":28,"open_issues_count":6,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-06T22:31:51.569Z","etag":null,"topics":["computer-vision","convolutional-neural-networks","deep-learning","machine-learning","transformer","vision-transformer"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2304.05350","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rishit-dagli.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}},"created_at":"2023-11-05T01:25:14.000Z","updated_at":"2025-05-01T00:34:59.000Z","dependencies_parsed_at":"2023-11-24T09:01:44.075Z","dependency_job_id":"b2433dfe-9f6d-4a8b-b522-c0e9aa0f1fec","html_url":"https://github.com/Rishit-dagli/Astroformer","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"e9fcef037dc8af842325d7a742266e7e36a5a45a"},"previous_names":["rishit-dagli/astroformer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rishit-dagli/Astroformer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rishit-dagli%2FAstroformer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rishit-dagli%2FAstroformer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rishit-dagli%2FAstroformer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rishit-dagli%2FAstroformer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rishit-dagli","download_url":"https://codeload.github.com/Rishit-dagli/Astroformer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rishit-dagli%2FAstroformer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279183447,"owners_count":26121402,"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-10-16T02:00:06.019Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["computer-vision","convolutional-neural-networks","deep-learning","machine-learning","transformer","vision-transformer"],"created_at":"2024-10-03T16:08:04.905Z","updated_at":"2025-10-16T11:27:43.732Z","avatar_url":"https://github.com/Rishit-dagli.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Astroformer\n\nThis repository contains the official implementation of Astroformer, an ICLR Workshop 2023 paper. This model is aimed at detection tasks in the low-data regimes and achieves SoTA results on CIFAR-100, Tiny Imagenet, and science tasks like Galaxy10 DECals, and competetive performance on CIFAR-10 _without any additional labelled or unlabelled data_.\n\n_**Accompanying paper: [Astroformer: More Data Might not be all you need for Classification](https://arxiv.org/abs/2304.05350)**_ [![arXiv](https://img.shields.io/badge/paper-arXiv:2304.05350-b31b1b.svg?logo=arxiv)](https://arxiv.org/abs/2304.05350)\n\n## Code Overview\n\nThe most important code is in `astroformer.py`. We trained Astroformers using the `timm` framework, which we copied from [here](https://github.com/huggingface/pytorch-image-models).\n\nInside `pytorch-image-models`, we have made the following modifications. (Though one could look at the diff, we think it is convenient to summarize them here.)\n\n- added `timm/models/astroformer.py`\n- modified `timm/models/__init__.py`\n\n## Training\n\nIf you had a node with 8 GPUs, you could train a Astroformer 5 as follows (these are exactly the settings we used for Galaxy10 DECals as well):\n\n```sh\nsh distributed_train.sh 8 [/path/to/dataset] \n    --train-split [your_train_dir] \n    --val-split [your_val_dir] \n    --model astroformer_5\n    --num-classes 10\n    --img-size 256\n    --in-chans 3\n    --input-size 3 256 256\n    --batch-size 256\n    --grad-accum-steps 1\n    --opt adamw\n    --sched cosine\n    --lr-base 2e-5\n    --lr-cycle-decay 1e-2\n    --lr-k-decay 1\n    --warmup-lr 1e-5\n    --epochs 300\n    --warmup-epochs 5\n    --mixup 0.8\n    --smoothing 0.1\n    --drop 0.1\n    --save-images\n    --amp\n    --amp-impl apex\n    --output result_ours/astroformer_5_galaxy10\n    --log-wandb\n```\n\nYou could simply use the same script with the other Astrofromer models: `astroformer_0`, `astroformer_1`, `astroformer_2`, `astroformer_3`, `astroformer_4`, and `astroformer_5` to train those variants as well.\n\n## Main Results\n\n### CIFAR-100\n\n| Model Name   | Top-1 Accuracy | FLOPs | Params |\n|--------------|----------------|-------|--------|\n| Astroformer-3| 87.65          | 31.36 | 161.95 |\n| Astroformer-4| 93.36          | 60.54 | 271.68 |\n| Astroformer-5| 89.38          | 115.97| 655.34 |\n\n### CIFAR-10\n\n| Model Name   | Top-1 Accuracy | FLOPs | Params |\n|--------------|----------------|-------|--------|\n| Astroformer-3| 99.12          | 31.36 | 161.75 |\n| Astroformer-4| 98.93          | 60.54 | 271.54 |\n| Astroformer-5| 93.23          | 115.97| 655.04 |\n\n### Tiny Imagenet\n\n| Model Name   | Top-1 Accuracy | FLOPs | Params |\n|--------------|----------------|-------|--------|\n| Astroformer-3| 86.86          | 24.84 | 150.39 |\n| Astroformer-4| 91.12          | 40.38 | 242.58 |\n| Astroformer-5| 92.98          | 89.88 | 595.55 |\n\n### Galaxy10 DECals\n\n| Model Name   | Top-1 Accuracy | FLOPs | Params |\n|--------------|----------------|-------|--------|\n| Astroformer-3| 92.39          | 31.36 | 161.75 |\n| Astroformer-4| 94.86          | 60.54 | 271.54 |\n| Astroformer-5| 94.81          | 105.9 | 681.25 |\n\n## Citation\n\nIf you use this work, please cite the following paper:\n\nBibTeX:\n\n```bibtex\n@article{dagli2023astroformer,\n  title={Astroformer: More Data Might Not be All You Need for Classification},\n  author={Dagli, Rishit},\n  journal={arXiv preprint arXiv:2304.05350},\n  year={2023}\n}\n```\n\nMLA:\n\n```\nDagli, Rishit. \"Astroformer: More Data Might Not be All You Need for Classification.\" arXiv preprint arXiv:2304.05350 (2023).\n```\n\n\n## Credits\n\nThe code is heavily adapted from [timm](https://github.com/huggingface/pytorch-image-models).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishit-dagli%2Fastroformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frishit-dagli%2Fastroformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishit-dagli%2Fastroformer/lists"}