-
Notifications
You must be signed in to change notification settings - Fork 231
Description
Greeting!
I followed the instruction in COOP.md and using command "scripts/coop/main.sh imagenet rn50_ep50 end 16 16 False"
But I got accuracy 60.6% which is quite far from the reported one 62.95%. It seems there's some missing piece that for finetuning on ImageNet, since the evaluation results using pretrained weights from goole link are correct. The following is my log.txt:
(Note that I pre-sample 16-shots data using method "generate_fewshot_dataset" and store them in a .json file)
** Arguments **
backbone:
config_file: configs/trainers/CoOp/rn50_ep50.yaml
dataset_config_file: configs/datasets/imagenet.yaml
eval_only: False
head:
load_epoch: None
model_dir:
no_train: False
opts: ['TRAINER.COOP.N_CTX', '16', 'TRAINER.COOP.CSC', 'False', 'TRAINER.COOP.CLASS_TOKEN_POSITION', 'end', 'DATASET.NUM_SHOTS', '16']
output_dir: output_random/imagenet/CoOp/rn50_ep50_16shots/nctx16_cscFalse_ctpend/seed1
resume:
root: /data/OpenSet
seed: 1
source_domains: None
target_domains: None
trainer: CoOp
transforms: None
** Config **
DATALOADER:
K_TRANSFORMS: 1
NUM_WORKERS: 8
RETURN_IMG0: False
TEST:
BATCH_SIZE: 100
SAMPLER: SequentialSampler
TRAIN_U:
BATCH_SIZE: 32
N_DOMAIN: 0
N_INS: 16
SAME_AS_X: True
SAMPLER: RandomSampler
TRAIN_X:
BATCH_SIZE: 32
N_DOMAIN: 0
N_INS: 16
SAMPLER: RandomSampler
DATASET:
ALL_AS_UNLABELED: False
CIFAR_C_LEVEL: 1
CIFAR_C_TYPE:
NAME: ImageNet
NUM_LABELED: -1
NUM_SHOTS: 16
ROOT: /data/OpenSet
SOURCE_DOMAINS: ()
STL10_FOLD: -1
SUBSAMPLE_CLASSES: all
TARGET_DOMAINS: ()
VAL_PERCENT: 0.1
INPUT:
COLORJITTER_B: 0.4
COLORJITTER_C: 0.4
COLORJITTER_H: 0.1
COLORJITTER_S: 0.4
CROP_PADDING: 4
CUTOUT_LEN: 16
CUTOUT_N: 1
GB_K: 21
GB_P: 0.5
GN_MEAN: 0.0
GN_STD: 0.15
INTERPOLATION: bicubic
NO_TRANSFORM: False
PIXEL_MEAN: [0.48145466, 0.4578275, 0.40821073]
PIXEL_STD: [0.26862954, 0.26130258, 0.27577711]
RANDAUGMENT_M: 10
RANDAUGMENT_N: 2
RGS_P: 0.2
RRCROP_SCALE: (0.08, 1.0)
SIZE: (224, 224)
TRANSFORMS: ('random_resized_crop', 'random_flip', 'normalize')
MODEL:
BACKBONE:
NAME: RN50
PRETRAINED: True
HEAD:
ACTIVATION: relu
BN: True
DROPOUT: 0.0
HIDDEN_LAYERS: ()
NAME:
INIT_WEIGHTS:
OPTIM:
ADAM_BETA1: 0.9
ADAM_BETA2: 0.999
BASE_LR_MULT: 0.1
GAMMA: 0.1
LR: 0.002
LR_SCHEDULER: cosine
MAX_EPOCH: 50
MOMENTUM: 0.9
NAME: sgd
NEW_LAYERS: ()
RMSPROP_ALPHA: 0.99
SGD_DAMPNING: 0
SGD_NESTEROV: False
STAGED_LR: False
STEPSIZE: (-1,)
WARMUP_CONS_LR: 1e-05
WARMUP_EPOCH: 1
WARMUP_MIN_LR: 1e-05
WARMUP_RECOUNT: True
WARMUP_TYPE: constant
WEIGHT_DECAY: 0.0005
OUTPUT_DIR: output_random/imagenet/CoOp/rn50_ep50_16shots/nctx16_cscFalse_ctpend/seed1
RESUME:
SEED: 1
TEST:
COMPUTE_CMAT: False
EVALUATOR: Classification
FINAL_MODEL: last_step
NO_TEST: False
PER_CLASS_RESULT: False
SPLIT: test
TRAIN:
CHECKPOINT_FREQ: 0
COUNT_ITER: train_x
PRINT_FREQ: 5
TRAINER:
CDAC:
CLASS_LR_MULTI: 10
P_THRESH: 0.95
RAMPUP_COEF: 30
RAMPUP_ITRS: 1000
STRONG_TRANSFORMS: ()
TOPK_MATCH: 5
COCOOP:
CTX_INIT:
N_CTX: 16
PREC: fp16
COOP:
CLASS_TOKEN_POSITION: end
CSC: False
CTX_INIT:
N_CTX: 16
PREC: fp16
CROSSGRAD:
ALPHA_D: 0.5
ALPHA_F: 0.5
EPS_D: 1.0
EPS_F: 1.0
DAEL:
CONF_THRE: 0.95
STRONG_TRANSFORMS: ()
WEIGHT_U: 0.5
DAELDG:
CONF_THRE: 0.95
STRONG_TRANSFORMS: ()
WEIGHT_U: 0.5
DDAIG:
ALPHA: 0.5
CLAMP: False
CLAMP_MAX: 1.0
CLAMP_MIN: -1.0
G_ARCH:
LMDA: 0.3
WARMUP: 0
DOMAINMIX:
ALPHA: 1.0
BETA: 1.0
TYPE: crossdomain
ENTMIN:
LMDA: 0.001
FIXMATCH:
CONF_THRE: 0.95
STRONG_TRANSFORMS: ()
WEIGHT_U: 1.0
M3SDA:
LMDA: 0.5
N_STEP_F: 4
MCD:
N_STEP_F: 4
MEANTEACHER:
EMA_ALPHA: 0.999
RAMPUP: 5
WEIGHT_U: 1.0
MIXMATCH:
MIXUP_BETA: 0.75
RAMPUP: 20000
TEMP: 2.0
WEIGHT_U: 100.0
MME:
LMDA: 0.1
NAME: CoOp
SE:
CONF_THRE: 0.95
EMA_ALPHA: 0.999
RAMPUP: 300
USE_CUDA: True
VERBOSE: True
VERSION: 1
Collecting env info ...
** System info **
PyTorch version: 2.4.0+cu124
Is debug build: False
CUDA used to build PyTorch: 12.4
ROCM used to build PyTorch: N/A
OS: Ubuntu 22.04.2 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.31.1
Libc version: glibc-2.35
Python version: 3.8.10 (default, Jun 4 2021, 15:09:15) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.15.0-134-generic-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 12.4.99
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA A100-SXM4-80GB
GPU 1: NVIDIA A100-SXM4-80GB
GPU 2: NVIDIA A100-SXM4-80GB
GPU 3: NVIDIA A100-SXM4-80GB
GPU 4: NVIDIA A100-SXM4-80GB
GPU 5: NVIDIA A100-SXM4-80GB
GPU 6: NVIDIA A100-SXM4-80GB
GPU 7: NVIDIA A100-SXM4-80GB
Nvidia driver version: 550.127.08
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 57 bits virtual
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Platinum 8350C CPU @ 2.60GHz
CPU family: 6
Model: 106
Thread(s) per core: 2
Core(s) per socket: 32
Socket(s): 2
Stepping: 6
CPU max MHz: 3500.0000
CPU min MHz: 800.0000
BogoMIPS: 5200.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid fsrm md_clear pconfig flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 3 MiB (64 instances)
L1i cache: 2 MiB (64 instances)
L2 cache: 80 MiB (64 instances)
L3 cache: 96 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-31,64-95
NUMA node1 CPU(s): 32-63,96-127
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Versions of relevant libraries:
[pip3] flake8==3.7.9
[pip3] kmeans-pytorch==0.3
[pip3] numpy==1.24.1
[pip3] torch==2.4.0+cu124
[pip3] torchaudio==2.4.0+cu124
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.19.0+cu124
[pip3] triton==3.0.0
[conda] kmeans-pytorch 0.3 pypi_0 pypi
[conda] numpy 1.24.1 pypi_0 pypi
[conda] torch 2.4.0+cu124 pypi_0 pypi
[conda] torchaudio 2.4.0+cu124 pypi_0 pypi
[conda] torchsummary 1.5.1 pypi_0 pypi
[conda] torchvision 0.19.0+cu124 pypi_0 pypi
[conda] triton 3.0.0 pypi_0 pypi
Pillow (10.2.0)
Loading trainer: CoOp
Loading dataset: ImageNet
Loading preprocessed few-shot data from /data/lanyun/worksapce/cross_modal_adaptation/indices/random/imagenet/shot_16-seed_1.json
Building transform_train
- random resized crop (size=(224, 224), scale=(0.08, 1.0))
- random flip
- to torch tensor of range [0, 1]
- normalization (mean=[0.48145466, 0.4578275, 0.40821073], std=[0.26862954, 0.26130258, 0.27577711])
Building transform_test - resize the smaller edge to 224
- 224x224 center crop
- to torch tensor of range [0, 1]
- normalization (mean=[0.48145466, 0.4578275, 0.40821073], std=[0.26862954, 0.26130258, 0.27577711])
Dataset ImageNet
- classes 1,000
- train_x 16,000
- val 50,000
- test 50,000
Loading CLIP (backbone: RN50)
Building custom CLIP
Initializing a generic context
Initial context: "X X X X X X X X X X X X X X X X"
Number of context words (tokens): 16
Turning off gradients in both the image and the text encoder
Loading evaluator: Classification
No checkpoint found, train from scratch
Initialize tensorboard (log_dir=output_random/imagenet/CoOp/rn50_ep50_16shots/nctx16_cscFalse_ctpend/seed1/tensorboard)
....
Checkpoint saved to output_random/imagenet/CoOp/rn50_ep50_16shots/nctx16_cscFalse_ctpend/seed1/prompt_learner/model.pth.tar-50
Finish training
Deploy the last-epoch model
Evaluate on the test set
=> result
- total: 50,000
- correct: 30,315
- accuracy: 60.6%
- error: 39.4%
- macro_f1: 59.8%
Elapsed: 1:58:44