-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain_train_feat.py
More file actions
57 lines (44 loc) · 1.42 KB
/
Copy pathmain_train_feat.py
File metadata and controls
57 lines (44 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# -*- coding: utf-8 -*-
"""
Stage 2 training quick start. Run: python main_train_feat.py
"""
from __future__ import annotations
from pathlib import Path
import params
from train_feature import build_parser, train
ROOT = Path(__file__).resolve().parent
DEMO_DATA = params.Kodak_path
DEMO_OUT = ROOT / "exp" / "demo_feature"
DEMO_HEAT = "weights/smp_heat_div2k.pth"
API_GUIDE = """
# Stage 2: train GaussianUNet_Plus (frozen heatmap)
from train_feature import build_parser, train
# Option A: programmatic (same data_path as stage 1)
args = build_parser().parse_args([
"--data_path", "2DGS_dataset/dataset/DIV2K/DIV2K_train_HR",
"--heat_weight", "weights/smp_heat_div2k.pth",
"--save_dir", "exp/feature_div2k",
"--num_epochs", "500",
"--lr", "1e-3",
"--batch_size", "8",
])
train(args)
# Option B: CLI
# python train_feature.py --data_path path/to/images --heat_weight weights/smp_heat_div2k.pth
"""
def main() -> None:
print(API_GUIDE.strip())
print("\n>>> Running demo (1 epoch, Kodak, frozen heat)...\n")
args = build_parser().parse_args([
"--data_path", DEMO_DATA,
"--heat_weight", DEMO_HEAT,
"--save_dir", str(DEMO_OUT),
"--num_epochs", "1",
"--batch_size", "2",
"--k_min", "5000",
"--k_max", "8000",
])
train(args)
print(f"\nnext: copy exp/demo_feature/feat_best.pth -> weights/ or run inference.py")
if __name__ == "__main__":
main()