clstm
clstm copied to clipboard
errors in test-ocr
below is the running log. i added some printf in the program. and locate the error happens at line 60 in the file clstm_compute.h the code calls the sum function of a tensor1 variable.
the version of Eigen i use is Eigen3.3-beta1
need some help here, thank you
export seed=0.7733
scons -s -c
rm -f test-lstm.o *.a
scons -j 4 debug=1 clstmocrtrain clstmfiltertrain clstmfilter clstmocr test-lstm scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... g++ --std=c++11 -Wno-unused-result -o clstmocrtrain.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 clstmocrtrain.cc g++ --std=c++11 -Wno-unused-result -o clstm.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 clstm.cc g++ --std=c++11 -Wno-unused-result -o ctc.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 ctc.cc protoc(["clstm", "clstm.pb.cc", "clstm.pb.h"], ["clstm.proto"]) g++ --std=c++11 -Wno-unused-result -o clstm_proto.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 clstm_proto.cc g++ --std=c++11 -Wno-unused-result -o clstm_prefab.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 clstm_prefab.cc g++ --std=c++11 -Wno-unused-result -o extras.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 extras.cc g++ --std=c++11 -Wno-unused-result -o clstm.pb.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 clstm.pb.cc g++ --std=c++11 -Wno-unused-result -o clstm_compute.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 clstm_compute.cc g++ --std=c++11 -Wno-unused-result -o clstmfiltertrain.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 clstmfiltertrain.cc g++ --std=c++11 -Wno-unused-result -o clstmfilter.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 clstmfilter.cc g++ --std=c++11 -Wno-unused-result -o clstmocr.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 clstmocr.cc g++ --std=c++11 -Wno-unused-result -o test-lstm.o -c -g -g -DCATCH=catch -DNODISPLAY=1 -DTHROW=throw -DTRY=try -I/usr/local/include/eigen3 test-lstm.cc ar rc libclstm.a clstm.o ctc.o clstm_proto.o clstm_prefab.o extras.o clstm.pb.o clstm_compute.o ranlib libclstm.a g++ --std=c++11 -Wno-unused-result -o test-lstm -g test-lstm.o libclstm.a -lpng -lprotobuf g++ --std=c++11 -Wno-unused-result -o clstmocr -g clstmocr.o libclstm.a -lpng -lprotobuf g++ --std=c++11 -Wno-unused-result -o clstmfilter -g clstmfilter.o libclstm.a -lpng -lprotobuf g++ --std=c++11 -Wno-unused-result -o clstmfiltertrain -g clstmfiltertrain.o libclstm.a -lpng -lprotobuf g++ --std=c++11 -Wno-unused-result -o clstmocrtrain -g clstmocrtrain.o libclstm.a -lpng -lprotobuf scons: done building targets.
./test-ocr.sh got 1 files, 0 tests got 15 classes .Stacked: 0.01 0.9 in 0 48 out 0 15 .Stacked.Parallel: 0.01 0.9 in 0 48 out 0 200 .Stacked.Parallel.NPLSTM: 0.01 0.9 in 0 48 out 0 100 .Stacked.Parallel.Reversed: 0.01 0.9 in 0 48 out 0 100 .Stacked.Parallel.Reversed.NPLSTM: 0.01 0.9 in 0 48 out 0 100 .Stacked.SoftmaxLayer: 0.01 0.9 in 0 200 out 0 15 loading done! for loop! trial = 0 reading sample training forward measure normalize set inputs net forward encode mktargets ctc_align_targets compute log probability for loop Tensor1 out(nc) nc = 15 fmax fmax end Dims = 1, dim 0: 15 out data 0.0662834, 0.0671138, 0.0670167, 0.0671662, 0.0665378, 0.0658698, 0.0676015, 0.0660524, 0.0659969, 0.0665682, 0.0666416, 0.0675991, 0.0667013, 0.0661178, 0.0667335, m.sumI() clstmocrtrain: /usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h:108: void Eigen::TensorStorage<T, Eigen::DSizes<IndexType, NumIndices_>, Options_>::resize(Eigen::TensorStorage<T, Eigen::DSizes<IndexType, NumIndices_>, Options_>::Index, Eigen::array<IndexType, NumIndices_>&) [with T = float; int Options_ = 0; IndexType = long int; int NumIndices_ = 1; Eigen::TensorStorage<T, Eigen::DSizes<IndexType, NumIndices_>, Options_>::Index = long int; Eigen::array<IndexType, NumIndices_> = std::array<long int, 1ul>]: Assertion `size >= 1' failed. ./test-ocr.sh: line 6: 4659 Aborted (core dumped) ntrain=201 hidden=50 lrate=1e-2 save_name=_ocrtest ./clstmocrtrain _ocrtest.txt clstmocrtrain FAILED
echo TEST FAILED TEST FAILED
update: problem solved. it is probably caused by the function in the tensor module in Eigen. two function calls assertion. one at line 60 of the file ctc.cc, sum(out) which sums all the element in out the other at line 79 of the same file, maximum(both) which returns the maximum value of all elements in both. re-implement this two function by yourself and the test will work
Try again; I finally merged the Eigen::Tensor version into the master branch. There are a several built-in test cases now.