Pārlūkot izejas kodu

Use Huber loss instead of MSE

nagadomi 9 gadi atpakaļ
vecāks
revīzija
290a5f960b
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  1. 5 1
      train.lua

+ 5 - 1
train.lua

@@ -78,7 +78,11 @@ local function create_criterion(model)
       weight[3]:fill(0.11448 * 3) -- B
       return w2nn.ClippedWeightedHuberCriterion(weight, 0.1, {0.0, 1.0}):cuda()
    else
-      return nn.MSECriterion():cuda()
+      local offset = reconstruct.offset_size(model)
+      local output_w = settings.crop_size - offset * 2
+      local weight = torch.Tensor(1, output_w * output_w)
+      weight[1]:fill(1.0)
+      return w2nn.ClippedWeightedHuberCriterion(weight, 0.1, {0.0, 1.0}):cuda()
    end
 end
 local function transformer(x, is_validation, n, offset)