Skip to content

Commit

Permalink
Merge pull request #10 from PRIS-CV/onion-release
Browse files Browse the repository at this point in the history
Onion release
  • Loading branch information
dongliangchang authored Feb 6, 2023
2 parents 1e6a371 + 8814240 commit d12521c
Show file tree
Hide file tree
Showing 59 changed files with 2,813 additions and 215 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ __pycache__
.ipynb_checkpoints
cam_images/
.vscode
ut.py

Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ TRANSFORMS:

OPTIMIZER:
NAME: "SGD"
MOMENTUM: 0.9
ARGS:
- momentum: 0.9
- weight_decay: 0.0005
LR:
base: 0.002
backbone: 0.002
encoder: 0.01
necks: 0.01
Expand All @@ -124,7 +127,7 @@ OPTIMIZER:
ITERATION_NUM: ~
EPOCH_NUM: 100
START_EPOCH: 0
UPDATE_STRATEGY: "general_updating"
UPDATE_STRATEGY: "general_strategy"


# Validation details
Expand Down
10 changes: 6 additions & 4 deletions configs/cal/cal_resnet101.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ TRANSFORMS:

OPTIMIZER:
NAME: SGD
MOMENTUM: 0.9
WEIGHT_DECAY: 1e-5
ARGS:
- momentum: 0.9
- weight_decay: 0.0005
LR:
base: 0.001
backbone: 0.001
encoder: 0.001
necks: 0.001
Expand All @@ -116,14 +118,14 @@ OPTIMIZER:
ITERATION_NUM: ~
EPOCH_NUM: 160
START_EPOCH: 0
UPDATE_STRATEGY: "general_updating"
UPDATE_STRATEGY: "general_strategy"
LR_SCHEDULE:
NAME: "adjusting_schedule"
ARGS:
- base_lr: 0.001
- base_duration: 2.0
- base_rate: 0.9
- update_level: "batch_update"
# - update_level: "batch_update"

# Validation details
PER_ITERATION: ~
Expand Down
14 changes: 6 additions & 8 deletions configs/mutual_channel_loss/mcl_vgg16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ TRANSFORMS:

OPTIMIZER:
NAME: SGD
MOMENTUM: 0.9
ARGS:
- momentum: 0.9
- weight_decay: 0.0005
LR:
base: 0.001
backbone: 0.001
encoder: 0.01
necks: 0.01
Expand All @@ -112,7 +115,7 @@ OPTIMIZER:
ITERATION_NUM: ~
EPOCH_NUM: 200
START_EPOCH: 0
UPDATE_STRATEGY: "general_updating"
UPDATE_STRATEGY: "general_strategy"

# Validation details
PER_ITERATION: ~
Expand All @@ -134,9 +137,4 @@ METRICS:
metric: "precision"
top_k: ~
threshold: 0.5

INTERPRETER:
NAME: "cam"
METHOD: "gradcam"
TARGET_LAYERS:
- "layer4"

10 changes: 4 additions & 6 deletions configs/progressive_multi_granularity_learning/pmg_resnet50.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ TRANSFORMS:

OPTIMIZER:
NAME: "SGD"
MOMENTUM: 0.9
ARGS:
- momentum: 0.9
- weight_decay: 0.0005
LR:
base: 0.0002
backbone: 0.0002
encoder: 0.002
necks: 0.002
Expand Down Expand Up @@ -140,8 +143,3 @@ METRICS:
top_k: ~
threshold: 0.5

INTERPRETER:
NAME: "cam"
METHOD: "gradcam"
TARGET_LAYERS:
- "layer4"
21 changes: 14 additions & 7 deletions configs/progressive_multi_granularity_learning/pmg_v2_resnet50.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ DATASET:
MODEL:
NAME: "PMG_V2"
CLASS_NUM: 200
ARGS:
- outputs_num: 3
- BLOCKS:
- [8, 8, 0, 0]
- [4, 4, 4, 0]
- [2, 2, 2, 2]
- alpha:
- 0.01
- 0.05
- 0.1
CRITERIONS:
- name: "cross_entropy_loss"
args: []
Expand Down Expand Up @@ -108,8 +118,11 @@ TRANSFORMS:

OPTIMIZER:
NAME: "SGD"
MOMENTUM: 0.9
ARGS:
- momentum: 0.9
- weight_decay: 0.0005
LR:
base: 0.0005
backbone: 0.0005
encoder: ~
necks: 0.005
Expand Down Expand Up @@ -140,9 +153,3 @@ METRICS:
metric: "precision"
top_k: ~
threshold: 0.5

INTERPRETER:
NAME: "cam"
METHOD: "gradcam"
TARGET_LAYERS:
- "layer4"
11 changes: 7 additions & 4 deletions configs/resnet/resnet50.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,20 @@ TRANSFORMS:

OPTIMIZER:
NAME: "SGD"
MOMENTUM: 0.9
LR:
ARGS:
- momentum: 0.9
- weight_decay: 0.0005
LR:
base: 0.0002
backbone: 0.0002
encoder: 0.002
necks: 0.002
heads: 0.002

ITERATION_NUM: ~
EPOCH_NUM: 1
EPOCH_NUM: 50
START_EPOCH: 0
UPDATE_STRATEGY: "general_updating"
UPDATE_STRATEGY: "general_strategy"

# Validation details
PER_ITERATION: ~
Expand Down
7 changes: 5 additions & 2 deletions configs/resnet/resnet50_cutmix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ TRANSFORMS:

OPTIMIZER:
NAME: "SGD"
MOMENTUM: 0.9
LR:
ARGS:
- momentum: 0.9
- weight_decay: 0.0005
LR:
base: 0.0002
backbone: 0.0002
encoder: 0.002
necks: 0.002
Expand Down
168 changes: 168 additions & 0 deletions configs/swin_transformer/swin_transformer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
EXP_NAME: "SwinT"

RESUME_WEIGHT: ~

DISTRIBUTED: False

WEIGHT:
NAME: "swinT.pth"
SAVE_DIR: "/mnt/sdb/data/wangxinran/weight/fgvclib"

LOGGER:
NAME: "txt_logger"

DATASET:
NAME: "CUB_200_2011"
ROOT: "/mnt/sdb/data/wangxinran/dataset"
TRAIN:
BATCH_SIZE: 16
POSITIVE: 0
PIN_MEMORY: True
SHUFFLE: True
NUM_WORKERS: 4
TEST:
BATCH_SIZE: 16
POSITIVE: 0
PIN_MEMORY: False
SHUFFLE: True
NUM_WORKERS: 4

MODEL:
NAME: "SwinTransformer"
CLASS_NUM: 200
ARGS:
- img_size: 384
- fpn_size: 1536
- lambda_s: 0.0
- lambda_n: 5.0
- lambda_b: 0.5
- lambda_c: 1.0
- update_freq: 2
- use_selection: True
- use_fpn: True
- use_combiner: True
- num_select:
- layer1: 2048
- layer2: 512
- layer3: 128
- layer4: 32

CRITERIONS:
- name: "cross_entropy_loss"
args: []
w: 1.0
- name: "mean_square_error_loss"
args: []
w: 1.0
BACKBONE:
NAME: "swin_large_patch4_window12_384_in22k"
ARGS:
- pretrained: True
ENCODER:
NAME: ~
NECKS:
NAME: ~
HEADS:
NAME: "GCN_combiner"
ARGS:
- num_selects:
- layer1: 2048
- layer2: 512
- layer3: 128
- layer4: 32
- total_num_selects: 2720
- num_classes: 200
- fpn_size: 1536

TRANSFORMS:
TRAIN:
- name: "resize"
size:
- 510
- 510
- name: "random_crop"
size: 384
padding: 0
- name: "random_horizontal_flip"
prob: 0.5
- name: "randomApply_gaussianBlur"
prob: 0.1
- name: "randomAdjust_sharpness"
sharpness_factor: 1.5
prob: 0.1
- name: "to_tensor"
- name: "normalize"
mean:
- 0.485
- 0.456
- 0.406
std:
- 0.229
- 0.224
- 0.225
TEST:
- name: "resize"
size:
- 510
- 510
- name: "center_crop"
size: 384
- name: "to_tensor"
- name: "normalize"
mean:
- 0.485
- 0.456
- 0.406
std:
- 0.229
- 0.224
- 0.225

OPTIMIZER:
NAME: "AdamW"
ARGS:
- weight_decay: 0.0005
LR:
base: 0.0001
backbone: 0.0001
encoder: 0.0001
necks: 0.0001
heads: 0.0001

LR_SCHEDULE:
NAME: "warmup_cosine_decay_schedule"
ARGS:
- warmup_steps: 800
- max_lr: 0.0001
- max_epochs: 50
- decay_type: 1

ITERATION_NUM: ~
EPOCH_NUM: 50
START_EPOCH: 0
AMP: True
UPDATE_STRATEGY: ""
UPDATE_FUNCTION: "update_swin_transformer"
EVALUATE_FUNCTION: "swin_transformer_evaluate"

# Validation details
PER_ITERATION: ~
PER_EPOCH: ~
METRICS:
- name: "accuracy(topk=1)"
metric: "accuracy"
top_k: 1
threshold: ~
- name: "accuracy(topk=5)"
metric: "accuracy"
top_k: 5
threshold: ~
- name: "recall(threshold=0.5)"
metric: "recall"
top_k: ~
threshold: 0.5
- name: "precision(threshold=0.5)"
metric: "precision"
top_k: ~
threshold: 0.5

Loading

0 comments on commit d12521c

Please sign in to comment.