Skip to content

Commit 2218431

Browse files
author
jizong
committed
initial commit
1 parent 23c8cf8 commit 2218431

64 files changed

Lines changed: 5439 additions & 295 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 529 additions & 0 deletions
Large diffs are not rendered by default.

config/config.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
RandomSeed: 10
2+
3+
Arch:
4+
input_dim: 1
5+
num_classes: 4
6+
7+
Augment: strong
8+
9+
Data:
10+
labeled_data_ratio: 0.05
11+
unlabeled_data_ratio: 0.95
12+
13+
ContrastData:
14+
group_sample_num: 8
15+
partition_sample_num: 1
16+
num_workers: 6
17+
shuffle: false
18+
19+
LabeledData:
20+
shuffle: true
21+
batch_size: 16
22+
num_workers: 8
23+
24+
Trainer:
25+
name: contrast
26+
save_dir: test_semi_trainer
27+
device: cuda
28+
num_batches: 500
29+
max_epoch_train_decoder: 50
30+
max_epoch_train_encoder: 100
31+
max_epoch_train_finetune: 80
32+
train_encoder: True
33+
train_decoder: True
34+
35+
PretrainEncoder:
36+
group_option: partition
37+
lr: 0.000001
38+
weight_decay: 0.00001
39+
multiplier: 300
40+
warmup_max: 10
41+
extract_position: Conv5
42+
ptype: mlp
43+
44+
PretrainDecoder:
45+
lr: 0.000001
46+
weight_decay: 0.0
47+
multiplier: 300
48+
warmup_max: 10
49+
enable_grad_from: Conv1
50+
extract_position: Up_conv3
51+
ptype: mlp
52+
53+
54+
FineTune:
55+
lr: 0.0000001
56+
weight_decay: 0.00001
57+
multiplier: 400
58+
warmup_max: 10
59+
60+
61+
62+
#Checkpoint: runs/test_pipeline

config/semi.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
RandomSeed: 10
2+
3+
Arch:
4+
input_dim: 1
5+
num_classes: 4
6+
7+
Optim:
8+
name: Adam
9+
lr: 0.0000001
10+
weight_decay: 0.00001
11+
12+
Scheduler:
13+
multiplier: 400
14+
warmup_max: 10
15+
16+
Data:
17+
name: acdc
18+
labeled_data_ratio: 0.05
19+
unlabeled_data_ratio: 0.95
20+
21+
LabeledData:
22+
shuffle: true
23+
batch_size: 4
24+
num_workers: 4
25+
26+
UnlabeledData:
27+
shuffle: true
28+
batch_size: 10
29+
num_workers: 4
30+
31+
Trainer:
32+
feature_names: ["Conv5", "Up_conv3", "Up_conv2"]
33+
feature_importance: [1, 0.5, 0.5]
34+
name: partial
35+
save_dir: tmp
36+
device: cuda
37+
num_batches: 500
38+
max_epoch: 100
39+
40+
UDARegCriterion:
41+
name: mse # kl
42+
weight: 5.0
43+
44+
IICRegParameters:
45+
EncoderParams:
46+
num_clusters: 20
47+
num_subheads: 5
48+
head_types: linear
49+
normalize: false
50+
51+
DecoderParams:
52+
num_clusters: 20
53+
num_subheads: 5
54+
head_types: linear
55+
normalize: false
56+
57+
LossParams:
58+
paddings: [1, 3]
59+
patch_sizes: 1024
60+
61+
weight: 0.1
62+
63+
EntropyMinParameters:
64+
weight: 0.00001
65+
66+
MeanTeacherParameters:
67+
name: mse
68+
weight: 10
69+
alpha: 0.999
70+
weight_decay: 0.000001
71+
72+
MIDLPaperParameters:
73+
iic_weight: 0.1
74+
padding: 1
75+
patch_size: 1024
76+
77+
78+
79+
80+
81+
82+
#Checkpoint: runs/test_pipeline

contrastyou/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from pathlib import Path
2+
3+
from contrastyou.arch import _register_arch
4+
5+
PROJECT_PATH = str(Path(__file__).parents[1])
6+
DATA_PATH = str(Path(PROJECT_PATH) / ".data")
7+
Path(DATA_PATH).mkdir(exist_ok=True, parents=True)
8+
CONFIG_PATH = str(Path(PROJECT_PATH, "config"))
9+
10+
_ = _register_arch

contrastyou/arch/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from deepclustering2.arch import _register_arch
2+
from .unet import UNet, FeatureExtractor as UNetFeatureExtractor
3+
4+
_register_arch("ContrastUnet", UNet)

0 commit comments

Comments
 (0)