im2markup icon indicating copy to clipboard operation
im2markup copied to clipboard

Unable to train after data augmentation

Open saurabhvyas opened this issue 8 years ago • 3 comments

I have taken formulas file from original dataset, and created 7 different renderings for each formula, now for training my files are as follows

vocab file : same as dataset formulas and formulas.norm files generated by https://github.com/Miffyli/im2latex-dataset images folder, with all images preprocessed , again using above repo and also train_filter.lst, validation_filter.lst, and test_filter.lst

When I am running training th src/train.lua -phase train -gpu_id 1 -model_dir model -input_feed -prealloc -data_base_dir input_files/img5 -data_path input_files/train.lst -val_data_path input_files/validation.lst -label_path input_files/formulas.norm.lst -vocab_file input_files/latex_vocab.txt -max_num_tokens 150 -max_image_width 500 -max_image_height 160 -batch_size 10 -beam_size 1 , its throwing the following error

a
[06/28/18 11:52:50]  Command Line Arguments:	
[06/28/18 11:52:50]  -phase train -gpu_id 1 -model_dir model -input_feed -prealloc -data_base_dir input_files/img5 -data_path input_files/train.lst -val_data_path input_files/validation.lst -label_path input_files/formulas.norm.lst -vocab_file input_files/latex_vocab.txt -max_num_tokens 150 -max_image_width 500 -max_image_height 160 -batch_size 10 -beam_size 1	
[06/28/18 11:52:50]  End Command Line Arguments	
[06/28/18 11:52:50]  Using CUDA on GPU 1	
[06/28/18 11:52:50]  Building model	
[06/28/18 11:52:50]  Creating model with fresh parameters	
[06/28/18 11:52:50]  Loading vocab from input_files/latex_vocab.txt	
[06/28/18 11:52:50]  Switching on memory preallocation	
[06/28/18 11:52:50]  cnn_featuer_size: 512	
[06/28/18 11:52:50]  dropout: 0.000000	
[06/28/18 11:52:50]  encoder_num_hidden: 256	
[06/28/18 11:52:50]  encoder_num_layers: 1	
[06/28/18 11:52:50]  decoder_num_hidden: 512	
[06/28/18 11:52:50]  decoder_num_layers: 1	
[06/28/18 11:52:50]  target_vocab_size: 175	
[06/28/18 11:52:50]  target_embedding_size: 80	
[06/28/18 11:52:50]  max_encoder_l_w: 62	
[06/28/18 11:52:50]  max_encoder_l_h: 20	
[06/28/18 11:52:50]  max_decoder_l: 151	
[06/28/18 11:52:50]  input_feed: true	
[06/28/18 11:52:50]  batch_size: 10	
[06/28/18 11:52:50]  prealloc: true	
[06/28/18 11:52:50]  Number of parameters: 9255007	
[06/28/18 11:52:58]  Data base dir input_files/img5	
[06/28/18 11:52:58]  Load training data from input_files/train.lst	
[06/28/18 11:52:58]  Training data loaded from input_files/train.lst	
[06/28/18 11:52:58]  Load validation data from input_files/validation.lst	
[06/28/18 11:52:58]  Validation data loaded from input_files/validation.lst	
[06/28/18 11:52:58]  Lr: 0.100000	
/home/saurabh/torch/install/bin/luajit: bad argument #2 to '?' (out of range at /home/saurabh/torch/pkg/torch/generic/Tensor.c:913)
stack traceback:
	[C]: at 0x7f9cbfbef590
	[C]: in function '__index'
	/home/saurabh/torch/install/share/lua/5.1/image/init.lua:1840: in function 'rgb2y'
	src/data/data_gen.lua:78: in function 'nextBatch'
	src/train.lua:106: in function 'train'
	src/train.lua:289: in function 'main'
	src/train.lua:295: in main chunk
	[C]: in function 'dofile'
	...rabh/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: at 0x00405d50

Can anyone tell me what might be causing this, training with original dataset works fine.

saurabhvyas avatar Jun 28 '18 06:06 saurabhvyas

Apparently, after preprocessing for some reason my images were still not in grey scale, or maybe I copied the wrong folder while training, anyway I can confirm code is working fine with data augmentation.

saurabhvyas avatar Jun 28 '18 07:06 saurabhvyas

Great thanks for reporting!

da03 avatar Jun 28 '18 07:06 da03

I figure it out! The images in this project is in rgb scale, so it uses the function rgb2y to inverse it into grey scale. Maybe your images have been in grey scale, so you will encounter the rgb2y error.

Aliezliu avatar Jun 24 '19 10:06 Aliezliu