Skip to content

Commit

Permalink
modified the transformation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xjqi committed May 10, 2018
1 parent b47b554 commit 0c0575d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ You can skip steps "2" and modify the "test_generate_canvas.m" accordingly if yo
### Training
1. Transformation network
(1) cd "matlab_code";
(2) run "test_generate_transform.m" to generate training data for the transformation network, training data is stored in folder "../traindata/transform/";
(3) cd "../python-code";
(4) run "transformation.py" with setting "training_phase = True".
(2) run "train_generate_transform.m" to generate training data for the transformation network, training data is stored in folder "../traindata/transform/";
(3) run "resize_transform.m"
(4) cd "../python-code";
(5) run "transformation.py" with setting "training_phase = True".
2. Ordering network
(1) cd "matlab_code";
(2) run "train_generate_order.m" to generate training data for the ordering network, training data is stored in folder "../traindata/order/";
Expand Down
9 changes: 9 additions & 0 deletions matlab_code/resize_transform.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dirs = dir('../traindata/label_refine/*.png');
dirs = struct2cell(dirs);

mkdir('../traindata/label_refine_512/');
for i = 1:size(dirs,2)
img = imread(['../traindata/label_refine/' dirs{1,i}]);
img = imresize(img,[512,1024],'nearest');
imwrite(img,['../traindata/label_refine_512/' dirs{1,i}]);
end
4 changes: 2 additions & 2 deletions python_code/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from spatial_transformer import transformer
import numpy as np

training_phase = False
training_phase = True
if(training_phase):
rgb_path = "../traindata/RGB512Full/"
mat_path = "../traindata/transform/transform_512/"
label_path = "../traindata/label_refine/"
label_path = "../traindata/label_refine_512/"
save_model_path = "../trainedmodels/transform"
num_folder = 2
else:
Expand Down

0 comments on commit 0c0575d

Please sign in to comment.