Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a tutorial on how to use CLSTM instead of the python lstm in ocropy #75

Closed
midhunharikumar opened this issue Apr 7, 2016 · 2 comments

Comments

@midhunharikumar
Copy link

I'm trying to use the C++ version CLSTM in ocropy . i tried building the python parts using setup.py but it throws errors

`~/OCROpus/clstm$ python2 setup.py build
PY_CORE_CFLAGS -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I. -IInclude -I../Include -fPIC -DPy_BUILD_CORE
BLDSHARED x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
LDCXXSHARED c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
LDFLAGS -Wl,-Bsymbolic-functions -Wl,-z,relro
TESTPYTHON LD_LIBRARY_PATH=/build/buildd/python2.7-2.7.6/build-shared: ./python -Wd -3 -E -tt
CONFIG_ARGS '--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-unicode=ucs4' '--with-dbmliborder=bdb:gdbm' '--with-system-expat' '--with-system-ffi' '--with-fpectl' 'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
CONFIGURE_CFLAGS -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
LDSHARED x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
CONFIGURE_LDFLAGS -Wl,-Bsymbolic-functions -Wl,-z,relro
OPT -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes
PY_LDFLAGS -Wl,-Bsymbolic-functions -Wl,-z,relro
LINKFORSHARED -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
PY_CFLAGS -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
CFLAGS -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
running build
running build_py
copying clstm.py -> build/lib.linux-x86_64-2.7
running build_ext
building '_clstm' extension
swigging clstm.i to clstm_wrap.cpp
swig -python -c++ -I/usr/include/eigen3 -I/usr/local/include/eigen3 -I/usr/local/include -I/usr/include/hdf5/serial -I/usr/lib/python2.7/dist-packages/numpy/core/include -o clstm_wrap.cpp clstm.i
C compiler: x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -fPIC

compile options: '-I/usr/include/eigen3 -I/usr/local/include/eigen3 -I/usr/local/include -I/usr/include/hdf5/serial -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c'
extra options: '-std=c++11 -Wno-sign-compare -Dadd_raw=add -DNODISPLAY=1 -DTHROW=throw -DHGVERSION=""unknown""'
x86_64-linux-gnu-gcc: ctc.cc
x86_64-linux-gnu-gcc: clstm_wrap.cpp
clstm_wrap.cpp: In function ‘PyObject* wrap_Batch_resize(PyObject, PyObject_)’:
clstm_wrap.cpp:6253:15: error: ‘struct ocropus::Batch’ has no member named ‘resize’
(arg1)->resize(arg2,arg3);
^
clstm_wrap.cpp: In function ‘PyObject* wrap_Batch_setZero(PyObject, PyObject_)’:
clstm_wrap.cpp:6304:15: error: ‘struct ocropus::Batch’ has no member named ‘setZero’
(arg1)->setZero(arg2,arg3);
^
clstm_wrap.cpp: In function ‘PyObject* wrap_Batch_resize(PyObject, PyObject_)’:
clstm_wrap.cpp:6253:15: error: ‘struct ocropus::Batch’ has no member named ‘resize’
(arg1)->resize(arg2,arg3);
^
clstm_wrap.cpp: In function ‘PyObject* wrap_Batch_setZero(PyObject, PyObject_)’:
clstm_wrap.cpp:6304:15: error: ‘struct ocropus::Batch’ has no member named ‘setZero’
(arg1)->setZero(arg2,arg3);
^
error: Command "x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -fPIC -I/usr/include/eigen3 -I/usr/local/include/eigen3 -I/usr/local/include -I/usr/include/hdf5/serial -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c clstm_wrap.cpp -o build/temp.linux-x86_64-2.7/clstm_wrap.o -std=c++11 -Wno-sign-compare -Dadd_raw=add -DNODISPLAY=1 -DTHROW=throw -DHGVERSION=""unknown""" failed with exit status 1
`

Thats the output from console .

@tmbdev
Copy link
Owner

tmbdev commented Oct 27, 2016

You don't need to build the Python interface in order to use CLSTM as part of ocropy; you simply run clstmocr and clstmocrtrain instead of ocropus-rpred and ocropus-rtrain. Note that the command line options are different, but both take image files of text lines as inputs and produce text files as output.

@tmbdev tmbdev closed this as completed Oct 27, 2016
@kba
Copy link
Collaborator

kba commented Oct 28, 2016

We should document this in ocropy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants