浏览代码

Update scripts

nagadomi 9 年之前
父节点
当前提交
83e5d885f5
共有 8 个文件被更改,包括 114 次插入60 次删除
  1. 19 0
      appendix/train_upconv_7_art.sh
  2. 19 0
      appendix/train_upconv_7_photo.sh
  3. 0 21
      tools/export.sh
  4. 37 0
      tools/export_all.sh
  5. 0 23
      tools/rebuild.sh
  6. 39 0
      tools/rebuild_all.sh
  7. 0 8
      train.sh
  8. 0 8
      train_photo.sh

+ 19 - 0
appendix/train_upconv_7_art.sh

@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# convert data 
+th convert_data.lua -max_training_image_size 1600
+
+# scale
+th train.lua -save_history 1 -inner_epoch 1 -epoch 100 -scale 2 -model upconv_7 -method scale -model_dir models/test/upconv_7_rev3 -downsampling_filters "Box,Sinc" -test query/scale_test.png -backend cudnn -thread 4 
+
+# noise_scale
+th train.lua -save_history 1 -model upconv_7 -method noise_scale -noise_level 0 -model_dir models/test/yuv420_rev2 -downsampling_filters "Box,Sinc" -test query/noise_test.jpg -backend cudnn -thread 4  -resume models/test/upconv_7_rev3/scale2.0x_model.t7 -style art 
+th train.lua -save_history 1 -model upconv_7 -method noise_scale -noise_level 1 -model_dir models/test/yuv420_rev2 -downsampling_filters "Box,Sinc" -test query/noise_test.jpg -backend cudnn -thread 4  -resume models/test/upconv_7_rev3/scale2.0x_model.t7 -style art 
+th train.lua -save_history 1 -model upconv_7 -method noise_scale -noise_level 2 -model_dir models/test/yuv420_rev2 -downsampling_filters "Box,Sinc" -test query/noise_test.jpg -backend cudnn -thread 4  -resume models/test/upconv_7_rev3/scale2.0x_model.t7 -style art 
+th train.lua -save_history 1 -model upconv_7 -method noise_scale -noise_level 3 -model_dir models/test/yuv420_rev2 -downsampling_filters "Box,Sinc" -test query/noise_test.jpg -backend cudnn -thread 4  -resume models/test/upconv_7_rev3/scale2.0x_model.t7 -style art -nr_rate 1
+
+# noise
+th train.lua -save_history 1 -model vgg_7 -method noise -noise_level 0 -model_dir models/test/yuv420_rev2 -test query/noise_test.jpg -backend cudnn -thread 4 -style art -crop_size 32
+th train.lua -save_history 1 -model vgg_7 -method noise -noise_level 1 -model_dir models/test/yuv420_rev2 -test query/noise_test.jpg -backend cudnn -thread 3 -style art -crop_size 32
+th train.lua -save_history 1 -model vgg_7 -method noise -noise_level 2 -model_dir models/test/yuv420_rev2 -test query/noise_test.jpg -backend cudnn -thread 3 -style art -crop_size 32
+th train.lua -save_history 1 -model vgg_7 -method noise -noise_level 3 -model_dir models/test/yuv420_rev2 -test query/noise_test.jpg -backend cudnn -thread 3 -style art -crop_size 32 -nr_rate 1 

+ 19 - 0
appendix/train_upconv_7_photo.sh

@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# convert data
+th convert_data.lua -style photo -data_dir ./data/photo -max_training_image_size 1600
+
+# scale
+th train.lua -save_history 1 -model upconv_7 -downsampling_filters "Box,Sinc,Catrom" -style photo -data_dir ./data/photo -model_dir models/test/new_photo -test query/machine.png -color rgb -random_unsharp_mask_rate 0.3 -thread 3 -backend cudnn
+
+# noise_scale
+th train.lua -save_history 1 -model upconv_7 -downsampling_filters "Box,Sinc,Catrom" -style photo -method noise_scale -noise_level 0 -data_dir ./data/photo -model_dir models/test/new_photo -test query/bsd500.jpg -color rgb -random_unsharp_mask_rate 0.5 -thread 3 -backend cudnn -nr_rate 0.3 -resume models/test/new_photo/scale2.0x_model.t7 -oracle_rate 0.0 -active_cropping_rate 0 -resize_blur_min 1 -resize_blur_max 1
+th train.lua -save_history 1 -model upconv_7 -downsampling_filters "Box,Sinc,Catrom" -style photo -method noise_scale -noise_level 1 -data_dir ./data/photo -model_dir models/test/new_photo -test query/bsd500.jpg -color rgb -random_unsharp_mask_rate 0.5 -thread 3 -backend cudnn -nr_rate 0.3 -resume models/test/new_photo/scale2.0x_model.t7 -oracle_rate 0.0 -active_cropping_rate 0 -resize_blur_min 1 -resize_blur_max 1
+th train.lua -save_history 1 -model upconv_7 -downsampling_filters "Box,Sinc,Catrom" -style photo -method noise_scale -noise_level 2 -data_dir ./data/photo -model_dir models/test/new_photo -test query/bsd500.jpg -color rgb -random_unsharp_mask_rate 0.5 -thread 3 -backend cudnn -nr_rate 0.6 -resume models/test/new_photo/scale2.0x_model.t7 -oracle_rate 0.0 -active_cropping_rate 0 -resize_blur_min 1 -resize_blur_max 1
+th train.lua -save_history 1 -model upconv_7 -downsampling_filters "Box,Sinc,Catrom" -style photo -method noise_scale -noise_level 3 -data_dir ./data/photo -model_dir models/test/new_photo -test query/bsd500.jpg -color rgb -random_unsharp_mask_rate 0.5 -thread 3 -backend cudnn -nr_rate 1 -resume models/test/new_photo/scale2.0x_model.t7 -oracle_rate 0.0 -active_cropping_rate 0 -resize_blur_min 1 -resize_blur_max 1
+
+# noise
+th train.lua -save_history 1 -model vgg_7 -style photo -method noise -noise_level 0 -data_dir ./data/photo -model_dir models/test/new_photo -test query/bsd500.jpg -color rgb -random_unsharp_mask_rate 0.5 -thread 3 -backend cudnn -nr_rate 0.3 -oracle_rate 0.0 -active_cropping_rate 0 -resize_blur_min 1 -resize_blur_max 1 -crop_size 32 
+th train.lua -save_history 1 -model vgg_7 -style photo -method noise -noise_level 1 -data_dir ./data/photo -model_dir models/test/new_photo -test query/bsd500.jpg -color rgb -random_unsharp_mask_rate 0.5 -thread 3 -backend cudnn -nr_rate 0.3 -oracle_rate 0.0 -active_cropping_rate 0 -resize_blur_min 1 -resize_blur_max 1 -crop_size 32 
+th train.lua -save_history 1 -model vgg_7 -style photo -method noise -noise_level 2 -data_dir ./data/photo -model_dir models/test/new_photo -test query/bsd500.jpg -color rgb -random_unsharp_mask_rate 0.5 -thread 3 -backend cudnn -nr_rate 0.6 -oracle_rate 0.0 -active_cropping_rate 0 -resize_blur_min 1 -resize_blur_max 1 -crop_size 32 
+th train.lua -save_history 1 -model vgg_7 -style photo -method noise -noise_level 3 -data_dir ./data/photo -model_dir models/test/new_photo -test query/bsd500.jpg -color rgb -random_unsharp_mask_rate 0.5 -thread 3 -backend cudnn -nr_rate 1 -oracle_rate 0.0 -active_cropping_rate 0 -resize_blur_min 1 -resize_blur_max 1 -crop_size 32 

+ 0 - 21
tools/export.sh

@@ -1,21 +0,0 @@
-#!/bin/sh -x
-
-export_model() {
-    if [ -f models/${1}/scale2.0x_model.t7 ] && [ ! -h models/${1}/scale2.0x_model.t7 ] ; then
-	th tools/export_model.lua -i models/${1}/scale2.0x_model.t7 -o models/${1}/scale2.0x_model.json
-    fi
-    if [ -f models/${1}/noise1_model.t7 ] && [ ! -h models/${1}/noise1_model.t7 ]; then
-	th tools/export_model.lua -i models/${1}/noise1_model.t7 -o models/${1}/noise1_model.json
-    fi
-    if [ -f models/${1}/noise2_model.t7 ] && [ ! -h models/${1}/noise2_model.t7 ]; then
-	th tools/export_model.lua -i models/${1}/noise2_model.t7 -o models/${1}/noise2_model.json
-    fi
-    if [ -f models/${1}/noise3_model.t7 ] && [ ! -h models/${1}/noise3_model.t7 ]; then
-	th tools/export_model.lua -i models/${1}/noise3_model.t7 -o models/${1}/noise3_model.json
-    fi
-}
-export_model vgg_7/art
-export_model vgg_7/art_y
-export_model vgg_7/photo
-export_model vgg_7/ukbench
-export_model upconv_7/art

+ 37 - 0
tools/export_all.sh

@@ -0,0 +1,37 @@
+#!/bin/sh -x
+
+export_model() {
+    if [ -f models/${1}/scale2.0x_model.t7 ] && [ ! -h models/${1}/scale2.0x_model.t7 ] ; then
+	th tools/export_model.lua -i models/${1}/scale2.0x_model.t7 -o models/${1}/scale2.0x_model.json
+    fi
+
+    if [ -f models/${1}/noise0_model.t7 ] && [ ! -h models/${1}/noise0_model.t7 ]; then
+	th tools/export_model.lua -i models/${1}/noise0_model.t7 -o models/${1}/noise0_model.json
+    fi
+    if [ -f models/${1}/noise1_model.t7 ] && [ ! -h models/${1}/noise1_model.t7 ]; then
+	th tools/export_model.lua -i models/${1}/noise1_model.t7 -o models/${1}/noise1_model.json
+    fi
+    if [ -f models/${1}/noise2_model.t7 ] && [ ! -h models/${1}/noise2_model.t7 ]; then
+	th tools/export_model.lua -i models/${1}/noise2_model.t7 -o models/${1}/noise2_model.json
+    fi
+    if [ -f models/${1}/noise3_model.t7 ] && [ ! -h models/${1}/noise3_model.t7 ]; then
+	th tools/export_model.lua -i models/${1}/noise3_model.t7 -o models/${1}/noise3_model.json
+    fi
+
+    if [ -f models/${1}/noise0_scale2.0x_model.t7 ] && [ ! -h models/${1}/noise0_scale2.0x_model.t7 ]; then
+	th tools/export_model.lua -i models/${1}/noise0_scale2.0x_model.t7 -o models/${1}/noise0_scale2.0x_model.json
+    fi
+    if [ -f models/${1}/noise1_scale2.0x_model.t7 ] && [ ! -h models/${1}/noise1_scale2.0x_model.t7 ]; then
+	th tools/export_model.lua -i models/${1}/noise1_scale2.0x_model.t7 -o models/${1}/noise1_scale2.0x_model.json
+    fi
+    if [ -f models/${1}/noise2_scale2.0x_model.t7 ] && [ ! -h models/${1}/noise2_scale2.0x_model.t7 ]; then
+	th tools/export_model.lua -i models/${1}/noise2_scale2.0x_model.t7 -o models/${1}/noise2_scale2.0x_model.json
+    fi
+    if [ -f models/${1}/noise3_scale2.0x_model.t7 ] && [ ! -h models/${1}/noise3_scale2.0x_model.t7 ]; then
+	th tools/export_model.lua -i models/${1}/noise3_scale2.0x_model.t7 -o models/${1}/noise3_scale2.0x_model.json
+    fi
+}
+export_model vgg_7/art
+export_model upconv_7/art
+export_model vgg_7/photo
+export_model upconv_7/photo

+ 0 - 23
tools/rebuild.sh

@@ -1,23 +0,0 @@
-#!/bin/sh -x
-
-# maybe you should backup models
-
-rebuild() {
-    if [ -f models/${1}/scale2.0x_model.t7 ] && [ ! -h models/${1}/scale2.0x_model.t7 ] ; then
-	th tools/rebuild_model.lua -i models/${1}/scale2.0x_model.t7 -o models/${1}/scale2.0x_model.t7 -backend cunn -model $2
-    fi
-    if [ -f models/${1}/noise1_model.t7 ] && [ ! -h models/${1}/noise1_model.t7 ]; then
-	th tools/rebuild_model.lua -i models/${1}/noise1_model.t7 -o models/${1}/noise1_model.t7 -backend cunn -model $2
-    fi
-    if [ -f models/${1}/noise2_model.t7 ] && [ ! -h models/${1}/noise2_model.t7 ]; then
-	th tools/rebuild_model.lua -i models/${1}/noise2_model.t7 -o models/${1}/noise2_model.t7 -backend cunn -model $2
-    fi
-    if [ -f models/${1}/noise3_model.t7 ] && [ ! -h models/${1}/noise3_model.t7 ]; then
-	th tools/rebuild_model.lua -i models/${1}/noise3_model.t7 -o models/${1}/noise3_model.t7 -backend cunn -model $2
-    fi
-}
-rebuild vgg_7/art vgg_7
-rebuild vgg_7/art_y vgg_7
-rebuild vgg_7/photo vgg_7
-rebuild vgg_7/ukbench vgg_7
-rebuild upconv_7/art upconv_7

+ 39 - 0
tools/rebuild_all.sh

@@ -0,0 +1,39 @@
+#!/bin/sh -x
+
+# you should backup models
+
+rebuild() {
+    if [ -f models/${1}/scale2.0x_model.t7 ] && [ ! -h models/${1}/scale2.0x_model.t7 ] ; then
+	th tools/rebuild_model.lua -i models/${1}/scale2.0x_model.t7 -o models/${1}/scale2.0x_model.t7 -backend cunn -model $2
+    fi
+
+    if [ -f models/${1}/noise0_model.t7 ] && [ ! -h models/${1}/noise0_model.t7 ]; then
+	th tools/rebuild_model.lua -i models/${1}/noise0_model.t7 -o models/${1}/noise0_model.t7 -backend cunn -model $2
+    fi
+    if [ -f models/${1}/noise1_model.t7 ] && [ ! -h models/${1}/noise1_model.t7 ]; then
+	th tools/rebuild_model.lua -i models/${1}/noise1_model.t7 -o models/${1}/noise1_model.t7 -backend cunn -model $2
+    fi
+    if [ -f models/${1}/noise2_model.t7 ] && [ ! -h models/${1}/noise2_model.t7 ]; then
+	th tools/rebuild_model.lua -i models/${1}/noise2_model.t7 -o models/${1}/noise2_model.t7 -backend cunn -model $2
+    fi
+    if [ -f models/${1}/noise3_model.t7 ] && [ ! -h models/${1}/noise3_model.t7 ]; then
+	th tools/rebuild_model.lua -i models/${1}/noise3_model.t7 -o models/${1}/noise3_model.t7 -backend cunn -model $2
+    fi
+
+    if [ -f models/${1}/noise0_scale2.0x_model.t7 ] && [ ! -h models/${1}/noise0_scale2.0x_model.t7 ]; then
+	th tools/rebuild_model.lua -i models/${1}/noise1_scale2.0x_model.t7 -o models/${1}/noise1_scale2.0x_model.t7  -backend cunn -model $2
+    fi
+    if [ -f models/${1}/noise1_scale2.0x_model.t7 ] && [ ! -h models/${1}/noise1_scale2.0x_model.t7 ]; then
+	th tools/rebuild_model.lua -i models/${1}/noise1_scale2.0x_model.t7 -o models/${1}/noise1_scale2.0x_model.t7  -backend cunn -model $2
+    fi
+    if [ -f models/${1}/noise2_scale2.0x_model.t7 ] && [ ! -h models/${1}/noise2_scale2.0x_model.t7 ]; then
+	th tools/rebuild_model.lua -i models/${1}/noise2_scale2.0x_model.t7 -o models/${1}/noise2_scale2.0x_model.t7  -backend cunn -model $2
+    fi
+    if [ -f models/${1}/noise3_scale2.0x_model.t7 ] && [ ! -h models/${1}/noise3_scale2.0x_model.t7 ]; then
+	th tools/rebuild_model.lua -i models/${1}/noise3_scale2.0x_model.t7 -o models/${1}/noise3_scale2.0x_model.t7  -backend cunn -model $2
+    fi
+}
+rebuild upconv_7/art upconv_7
+rebuild vgg_7/art vgg_7
+rebuild upconv_7/photo upconv_7
+rebuild vgg_7/photo vgg_7

+ 0 - 8
train.sh

@@ -1,8 +0,0 @@
-#!/bin/sh
-
-th convert_data.lua
-
-th train.lua -method scale -downsampling_filters "Box,Box,Blackman,Sinc,Lanczos" -model_dir models/anime_style_art_rgb -test images/miku_small.png # -thread 4 -backend cudnn
-th train.lua -method noise -noise_level 1 -style art -model_dir models/anime_style_art_rgb -test images/miku_noisy.png
-th train.lua -method noise -noise_level 2 -style art -model_dir models/anime_style_art_rgb -test images/miku_noisy.png
-th train.lua -method noise -noise_level 3 -style art -model_dir models/anime_style_art_rgb -test images/miku_noisy.png -nr_rate 1

+ 0 - 8
train_photo.sh

@@ -1,8 +0,0 @@
-#!/bin/sh
-
-th convert_data.lua -style photo -data_dir ./data/photo -model_dir models/photo
-
-th train.lua -style photo -method scale -data_dir ./data/photo -model_dir models/photo -test work/scale_test_photo.png -color rgb -random_unsharp_mask_rate 0.1 #-thread 4 -backend cudnn 
-th train.lua -style photo -method noise -noise_level 1 -data_dir ./data/photo -model_dir models/photo -test work/noise_test_photo.jpg -color rgb -random_unsharp_mask_rate 0.5 -nr_rate 0.6
-th train.lua -style photo -method noise -noise_level 2 -data_dir ./data/photo -model_dir models/photo -test work/noise_test_photo.jpg -color rgb -random_unsharp_mask_rate 0.5 -nr_rate 0.8
-th train.lua -style photo -method noise -noise_level 3 -data_dir ./data/photo -model_dir models/photo -test work/noise_test_photo.jpg -color rgb -random_unsharp_mask_rate 0.5 -nr_rate 1