1
0
Fork 0
mirror of synced 2024-06-23 08:41:01 +12:00

Update scripts

This commit is contained in:
nagadomi 2016-07-09 13:41:32 +09:00
parent 0300c714eb
commit 83e5d885f5
8 changed files with 114 additions and 60 deletions

19
appendix/train_upconv_7_art.sh Executable file
View file

@ -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

View file

@ -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

View file

@ -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
tools/export_all.sh Executable file
View file

@ -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

View file

@ -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
tools/rebuild_all.sh Executable file
View file

@ -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

View file

@ -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

View file

@ -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