Sfoglia il codice sorgente

Merge branch 'dev'

nagadomi 8 anni fa
parent
commit
5fe6cf6ef8
2 ha cambiato i file con 6 aggiunte e 7 eliminazioni
  1. 6 1
      lib/pairwise_transform_user.lua
  2. 0 6
      lib/pairwise_transform_utils.lua

+ 6 - 1
lib/pairwise_transform_user.lua

@@ -52,7 +52,12 @@ function pairwise_transform.user(x, y, size, offset, n, options)
 	    xc:add(-mean)
 	 end
       end
-      table.insert(batch, {xc, iproc.crop(yc, offset, offset, size - offset, size - offset)})
+      yc = iproc.crop(yc, offset, offset, size - offset, size - offset)
+      if options.pairwise_y_binary then
+	 yc[torch.lt(yc, 0.5)] = 0
+	 yc[torch.gt(yc, 0)] = 1
+      end
+      table.insert(batch, {xc, yc})
    end
 
    return batch

+ 0 - 6
lib/pairwise_transform_utils.lua

@@ -108,12 +108,6 @@ function pairwise_transform_utils.preprocess_user(x, y, scale_y, size, options)
 
    x = iproc.crop_mod4(x)
    y = iproc.crop_mod4(y)
-
-   if options.pairwise_y_binary then
-      y[torch.lt(y, 128)] = 0
-      y[torch.gt(y, 0)] = 255
-   end
-
    return x, y
 end
 function pairwise_transform_utils.active_cropping(x, y, lowres_y, size, scale, p, tries)