ZhexinLiang / CLIP-LIT

[ICCV 2023, Oral] Iterative Prompt Learning for Unsupervised Backlit Image Enhancement
https://zhexinliang.github.io/CLIP_LIT_page/
269 stars 23 forks source link

Questions about training #17

Open booker-max opened 8 months ago

booker-max commented 8 months ago

A wonderful job and I am so inspired. 关于这个方法的训练我存在一些问题

  1. 代码中在训练过程中存在三个阶段, (1) prompt initialization (2) fix the prompt and train the enhancement model (3) prompt fine-tuning 我准备在我自己的新数据集上train from scratch, 我应该按照何种顺序去执行这三个阶段,以及各个阶段需要执行多少个iteration. 代码中的判断语句用的有些多,我有些不太清楚,不好意思。

  2. 代码中的reinit_flag这个是什么意思

booker-max commented 8 months ago

我似乎看懂了您的训练过程,在您的训练代码中,整个训练流程为

  1. 先将prompt initialization训练8000个iteration
  2. 训练 enhance model 1000个iteration,
  3. 训练 enhance model 2100个iteration, 训练prompt fintune 1000个iteration, 再训练enhance model 2100个iteration, 训练prompt fintune 1000个iteration,以此类推。 不知道我描述得是否准确。
booker-max commented 8 months ago

您好,在您得代码中,存在变量 pr_semi_path 和 semi_path,这两个变量我不太理解,可以解释一下么,分别起什么作用

Henry-GongZY commented 7 months ago

您好,在您得代码中,存在变量 pr_semi_path 和 semi_path,这两个变量我不太理解,可以解释一下么,分别起什么作用

据我观察,作者使用 semi_path 保存历史最好模型的推理结果的路径,以加载这些结果用于计算后续的 Iterative Prompt Fine-tuning 过程的 Loss 。pr_semi_path 则是一个被反复置于0和1的变量,用于在 semi_path 中依次保存上次和本次最好的结果,分别对应论文损失函数提到的 $It$ 和 $I{t-1}$,具体哪个是 $It$ 哪个是 $I{t-1}$ 由 pr_semi_path 表示。

对于一个具体的代码运行流程,在运行完 9000 个 iter, 完成论文中提到的 Prompt Initialization Learning 步骤后 semi_path 开始记录 9000 ~ 11100 个 iter 中表现最好的模型的推理结果的路径,记录在 semi_path[0] 中,在 11100 ~ 12100 个 iter 中使用第二个分支的 DataLoaderLoss Function, 对应论文中的 $L_{prompt1}$ ,同时将 pr_semi_path 置为1,在 12100 ~ 14200 个 iter 中最好结果的路径记录在 semi_path[1] 中,14200 ~ 15200 个 iter 使用第三个分支的 DataLoaderLoss Function,对应论文中的 $L_{prompt2}$ ,semi_path[0]semi_path[1] 处加载的内容分别对应 $L{prompt2}$ 中提到的 $I{t-1}$ 和 $I_t$。依次类推轮流下去。