https://github.com/boostcampaitech5/level1_imageclassification-cv-09
level1_imageclassification-cv-09 created by GitHub Classroom
https://github.com/boostcampaitech5/level1_imageclassification-cv-09
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (6.9%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
level1_imageclassification-cv-09 created by GitHub Classroom
Basic Info
- Host: GitHub
- Owner: boostcampaitech5
- Language: Python
- Default Branch: main
- Size: 41.8 MB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Created over 3 years ago
· Last pushed about 3 years ago
https://github.com/boostcampaitech5/level1_imageclassification-cv-09/blob/main/
# Image Classication Competition  ## About : 1. 2. 3. 18 class#ViT32 #ViT16 #ModelSoups #Relabeling #Oversampling #ContrastiveLearnig #WeightedAverageEnsemble #HardVoting #SoftVoting #Optuna #Wandb **** ## Setting Step ### 1. ```bash conda env create -f environment.yml conda activate model_soups ``` ### 2. - wandb, albumentations ### 3. pretrained model - [Model soups](https://github.com/mlfoundations/model-soups/releases/tag/v0.0.2) ViT-B/32 - 72, 40 . ```bash python main.py --download-models --model-location
``` **** ## Training Step ### 1. ViT-B/32, ViT-B/16 #### 1-1. Fine Tuning ```bash python finetune.py --name {} --i { number} --random-seed { } ``` - [Model soups](https://github.com/mlfoundations/model-soups/releases/tag/v0.0.2) pretrained 18 class vector output 1 linear layer . - ViT-B/16 Model soups pretrained weight clip ImageNet pretrained weight . - `--model {ViT-B/32 | ViT-B/16}` : base - `--name` : - `--i` : pretrained model index - `--random-seed` : random seed - `--lr`, `--batch-size`, `--epochs`, `--data-location`, `--model-location` : learning rate, batch size, epoch, , - Tip : . training.sh ```bash bash training.sh ``` #### 1-2. Data oversampling - Age Old class train dataset Old class data Over sampling. - `--old-aug True` : Old class 1 over sampling #### 1-3. Loss Function - Interclass , Intraclass Contrastive Learning . - `--loss-fn` : ContrastiveLoss or CrossEntropyLoss, default CrossEntropyLoss ### 2. Model Soups - [Model soups](https://github.com/mlfoundations/model-soups/releases/tag/v0.0.2) pretrained . - . 1. pretrained model Test Accuracy . 2. Accuracy . 3. weight average . 4. Accuracy , 3, 4 . average 3, 4 . 5. Accuracy . #### 2-1. Fine Tuning - [Model soups](https://github.com/mlfoundations/model-soups/releases/tag/v0.0.2) pretrained model ViT-B/32 . - 1 Fine tuning . #### 2-2. Individual Evaluation ```bash python main.py --eval-individual-models --name {} --model-num { } --random-seed { } ``` - finetune accuracy . - `--name` : - `--model-num` : Evaludation - `--random-seed` : - `--val-ratio`, `--epoch`, `--data-location`, `--model-locatoin` : validation dataset , epoch, , - logs accuracy jsonl . #### 2-3. Greedy Soup ```bash python main.py --greedy-soup --name {} --model-num { } --random-seed { } ``` - individual Evaluation accuracy . greedy (averaging) . - `--name` : - `--model-num` : Evaludation - `--random-seed` : - `--val-ratio`, `--epoch`, `--data-location`, `--model-locatoin` : validation dataset , epoch, , - model . - log GREEDY_SOUP_LOG_FILE . averaging . **** ## Inference Step ### 1. w/ Validation dataset ```bash python validation.py --model-name {.pt } ``` - Validation set class . - , random seed . - `--model-name` : evaluation , - `--i` : pretrained model index - `--random-seed` : #### 1-1. Weighted Average Ensemble - Age class Age , class(18) weighted sum . - `--weighted-ensemble` : Age class , Default None ``` python finetune_age.py --name {} --i { number} --random-seed { } ``` - finetune_age.py Age class . - `--name`, `--i`, `--random-seed` finetune.py #### 1-2. Soft voting (Ensemble) - 2 class minmax scaling . - `--soft-voting` : soft voting , Default None #### 1-3. Hard voting (Ensemble) - csv Hard voting Ensemble . - hard_voting.ipynb , csv hard voting . . ### 2. Test w/ Test dataset ```bash python inference.py --model-name {.pt } ``` - (.pt) Test data . - `--model-name` : inference - `--weighted-ensemble`, `--soft-voting` : Weighted average ensemble , Soft Voting - csv output . **** ## Additional Step ### 1. Dataset Relabeling  - id relabel_dict Relabeling . ### 2. Hyperparameter Tuning ```bash python optuna_script.py ``` - Optuna Hyper paramter tuning . - optuna_script.py hyper parameter tuning . **** ## Result - Private score 3rd / F1 score - 0.7613 / Accuracy - 81.3175 - Public score 6th / F1 score - 0.7653 / Accuracy - 81.3968  **** ## Contributors | | | | || |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------:| | [
](https://github.com/june95)
| [](https://github.com/Hyunmin-H)
| [](https://github.com/hyuns66)
| [](https://github.com/jibeomkim7)
|[](https://github.com/jennifer060697)
| **** ## Reference Model soups : [Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time](https://arxiv.org/abs/2203.05482). ViT : https://github.com/google-research/vision_transformer ContrastiveLoss : https://github.com/KevinMusgrave/pytorch-metric-learning Optuna : https://optuna.org/ albumentations : https://albumentations.ai/ PyTorch : https://pytorch.org/ Wandb : https://wandb.ai/site
Owner
- Name: 부스트캠프 AI Tech 5기
- Login: boostcampaitech5
- Kind: organization
- Email: boostcamp_ai@connect.or.kr
- Location: Korea, South
- Website: https://boostcamp.connect.or.kr/program_ai.html
- Repositories: 1
- Profile: https://github.com/boostcampaitech5
AI 엔지니어의 지속 가능한 성장을 위한 학습 커뮤니티, 부스트캠프 AI Tech입니다.
#ViT32 #ViT16 #ModelSoups #Relabeling #Oversampling #ContrastiveLearnig #WeightedAverageEnsemble #HardVoting #SoftVoting #Optuna #Wandb
****
## Setting Step
### 1.
```bash
conda env create -f environment.yml
conda activate model_soups
```
### 2.
- wandb, albumentations
### 3. pretrained model
- [Model soups](https://github.com/mlfoundations/model-soups/releases/tag/v0.0.2) ViT-B/32
- 72, 40 .
```bash
python main.py --download-models --model-location
### 2. Test w/ Test dataset
```bash
python inference.py --model-name {.pt }
```
- (.pt) Test data .
- `--model-name` : inference
- `--weighted-ensemble`, `--soft-voting` : Weighted average ensemble , Soft Voting
- csv output .
****
## Additional Step
### 1. Dataset Relabeling

- id relabel_dict Relabeling .
### 2. Hyperparameter Tuning
```bash
python optuna_script.py
```
- Optuna Hyper paramter tuning .
- optuna_script.py hyper parameter tuning .
****
## Result
- Private score 3rd / F1 score - 0.7613 / Accuracy - 81.3175
- Public score 6th / F1 score - 0.7653 / Accuracy - 81.3968

****
## Contributors
| | | | ||
|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| [