oyxhust / CNN-LSTM-CTC-text-recognition

CNN and LSTM model for text recognition
259 stars 88 forks source link

build wrong about mxnet with warpctc,could you tell me the version of your mxnet and warpctc? #4

Closed changss closed 7 years ago

changss commented 7 years ago

begin fit [07:30:38] /home/chang/mxnet/dmlc-core/include/dmlc/logging.h:304: [07:30:38] src/operator/./slice_channel-inl.h:198: Check failed: ishape[real_axis] == static_cast(param_.num_outputs) (2400 vs. 80) If squeeze axis is True, the size of the sliced axis must be the same as num_outputs. Input shape=(32,2400), axis=1, num_outputs=80.

Stack trace returned 10 entries: [bt] (0) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4dmlc15LogMessageFatalD1Ev+0x3c) [0x7f2acf3787fc] [bt] (1) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNK5mxnet2op16SliceChannelProp10InferShapeEPSt6vectorIN4nnvm6TShapeESaIS4_EES7S7+0x4c1) [0x7f2ad01f5c61] [bt] (2) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(+0x12af4d8) [0x7f2acffbf4d8] [bt] (3) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(+0x23c4bdd) [0x7f2ad10d4bdd] [bt] (4) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(+0x23c64d2) [0x7f2ad10d64d2] [bt] (5) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4nnvm11ApplyPassesENS_5GraphERKSt6vectorISsSaISsEE+0x518) [0x7f2ad10c0c38] [bt] (6) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4nnvm9ApplyPassENS_5GraphERKSs+0x8e) [0x7f2acfe6cbce] [bt] (7) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4nnvm4pass10InferShapeENS_5GraphESt6vectorINS_6TShapeESaIS3_EESs+0x240) [0x7f2acfe6fa00] [bt] (8) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(MXSymbolInferShape+0x329) [0x7f2acfe67899] [bt] (9) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f2ad9b45adc]

infer_shape error. Arguments: label: (32, 4) l0_init_c: (32, 100) l1_init_h: (32, 100) l0_init_h: (32, 100) data: (32, 2400) l1_init_c: (32, 100) Traceback (most recent call last): File "lstm_ocr.py", line 210, in epoch_end_callback = mx.callback.do_checkpoint(prefix, 1)) File "../../python/mxnet/model.py", line 782, in fit self._init_params(data.provide_data+data.provide_label) File "../../python/mxnet/model.py", line 502, in _init_params argshapes, , aux_shapes = self.symbol.infer_shape(*input_shapes) File "../../python/mxnet/symbol.py", line 747, in infer_shape res = self._infer_shape_impl(False, args, **kwargs) File "../../python/mxnet/symbol.py", line 871, in _infer_shape_impl ctypes.byref(complete))) File "../../python/mxnet/base.py", line 84, in check_call raise MXNetError(py_str(_LIB.MXGetLastError())) mxnet.base.MXNetError: Error in operator slicechannel0: [07:30:38] src/operator/./slice_channel-inl.h:198: Check failed: ishape[real_axis] == static_cast(param_.num_outputs) (2400 vs. 80) If squeeze axis is True, the size of the sliced axis must be the same as num_outputs. Input shape=(32,2400), axis=1, num_outputs=80.

Stack trace returned 10 entries: [bt] (0) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4dmlc15LogMessageFatalD1Ev+0x3c) [0x7f2acf3787fc] [bt] (1) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZNK5mxnet2op16SliceChannelProp10InferShapeEPSt6vectorIN4nnvm6TShapeESaIS4_EES7S7+0x4c1) [0x7f2ad01f5c61] [bt] (2) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(+0x12af4d8) [0x7f2acffbf4d8] [bt] (3) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(+0x23c4bdd) [0x7f2ad10d4bdd] [bt] (4) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(+0x23c64d2) [0x7f2ad10d64d2] [bt] (5) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4nnvm11ApplyPassesENS_5GraphERKSt6vectorISsSaISsEE+0x518) [0x7f2ad10c0c38] [bt] (6) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4nnvm9ApplyPassENS_5GraphERKSs+0x8e) [0x7f2acfe6cbce] [bt] (7) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4nnvm4pass10InferShapeENS_5GraphESt6vectorINS_6TShapeESaIS3_EESs+0x240) [0x7f2acfe6fa00] [bt] (8) /home/chang/mxnet/python/mxnet/../../lib/libmxnet.so(MXSymbolInferShape+0x329) [0x7f2acfe67899] [bt] (9) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f2ad9b45adc]

changss commented 7 years ago

mxnet.base.MXNetError: Error in operator slicechannel0: [10:36:50] src/operator/./slice_channel-inl.h:198: Check failed: ishape[real_axis] == static_cast(param_.num_outputs) (2400 vs. 80) If squeeze axis is True, the size of the sliced axis must be the same as num_outputs. Input shape=(32,2400), axis=1, num_outputs=80.

oyxhust commented 7 years ago

You may use the latest mxnet, and the latest mxnet seems to have some modifications to the SliceChannel layer. My mxnet is downloaded in Dec 2016. I check the latest document of mxnet, they change the API of SliceChannel ("SliceChannel is depreacted. Use split instead.") and I think you can try use mx.sym.split to replace mx.sym.SliceChannel.

changss commented 7 years ago

@oyxhust I have change 'Slicechannel' to 'Split' , but problem still exist,

Check failed: ishape[real_axis] == static_cast(param_.num_outputs) (2400 vs. 80) If squeeze axis is True, the size of the sliced axis must be the same as num_outputs. Input shape=(32,2400), axis=1, num_outputs=80.

could you send an email to me which include your MXNET and swarp-ctc? my email box:799838602@qq.com

oyxhust commented 7 years ago

ok, I will send you my mxnet and warp-ctc.

kernel8liang commented 7 years ago

I have the same issue, @oyxhust could you tell the version of mxnet and swarp-ctc?

oyxhust commented 7 years ago

@changss @kernel8liang Hey, guys, sorry to reply late and I am too busy recently. My mxnet version is 0.7.0 and warp-ctc is this version (https://github.com/baidu-research/warp-ctc/tree/5bfb46e83bcb338a09fbf875cb0b02bc39746b36). If you use mxnet 0.7.0, you must use this version of warpctc, or you can copy the 'slice_channel.cc', 'slice_channel.cu' and 'slice_channel-inl.h' (under src/operator) into the newest mxnet, then I think my slice_channel code can be used. I also put my mxnet and warpctc on baiduyun, you can download from this link (http://pan.baidu.com/s/1dEDgPiD).