jetpacapp / DeepBeliefSDK

The SDK for Jetpac's iOS Deep Belief image recognition framework
Other
2.86k stars 437 forks source link

Framework not working on Xcode 6.2 / iOS 8.2? #41

Open maxi-mus opened 9 years ago

maxi-mus commented 9 years ago

Anyone else having issues running the framework on the newest software? I've been away from working on it for a while, so I may be overseeing something.

I get the following error on all my projects: Thread 5: EXC_BAD_ACCESS (code=1, address=0x9) at DeepBCustom`jpcnn_classify_image at libjpcnn.cpp:108:

petewarden commented 9 years ago

Sorry you're hitting problems. What platform are you running on?

petewarden commented 9 years ago

Never mind, I just spotted that in the title! I just tried a clean download of the SimpleiOS example and framework with iOS 8.2 and I wasn't able to reproduce the problem. Do you see the same thing?

maxi-mus commented 9 years ago

Yeah, the LearningExample is working for me too. Something in my customizations must be causing the crash, I'll report back when I find out what it is. The strange thing is one of my programs work just once today, then repeatedly causes the same crash again.

maxi-mus commented 9 years ago

Here's the extended output, maybe you'll see the problem at first glance. I tried with Xcode 5, same mistake there.

DeepBCust3`jpcnn_classifyimage at libjpcnn.cpp:108: 0x10000ec58: stp fp, lr, [sp, #-16]! 0x10000ec5c: mov fp, sp 0x10000ec60: stp x20, x19, [sp, #-16]! 0x10000ec64: stp x22, x21, [sp, #-16]! 0x10000ec68: stp x24, x23, [sp, #-16]! 0x10000ec6c: stp x26, x25, [sp, #-16]! 0x10000ec70: sub sp, sp, #144 0x10000ec74: mov x19, x7 0x10000ec78: mov x20, x6 0x10000ec7c: mov x22, x5 0x10000ec80: mov x24, x4 0x10000ec84: mov x23, x3 0x10000ec88: mov x25, x1 0x10000ec8c: mov x21, x0 0x10000ec90: nop
0x10000ec94: ldr x26, #119756 ; (void
)0x000000019c1b40a8: __stack_chkguard 0x10000ec98: ldr x8, [x26] 0x10000ec9c: stur x8, [fp, #-72] 0x10000eca0: and w8, w2, #0x1 0x10000eca4: ubfm w4, w2, #1, #1 0x10000eca8: ldrb w7, [x21, #9] 0x10000ecac: cmp w7, #0 0x10000ecb0: csinc w3, wzr, wzr, ne 0x10000ecb4: orr w9, wzr, #0xe0 0x10000ecb8: movz w10, #227 0x10000ecbc: csel w5, w10, w9, eq 0x10000ecc0: ldr w6, [x21, #32] 0x10000ecc4: ldr x1, [x21, #40] 0x10000ecc8: cmp w8, #0 0x10000eccc: csinc w2, wzr, wzr, ne 0x10000ecd0: add x0, sp, #48 0x10000ecd4: bl 0x10000da68 ; PrepareInput at prepareinput.cpp:47 0x10000ecd8: mov x1, x25 0x10000ecdc: bl 0x10000dfe8 ; PrepareInput::run(Buffer) at prepareinput.cpp 0x10000ece0: mov x1, x0 0x10000ece4: mov x0, x21 0x10000ece8: mov x2, x23 0x10000ecec: bl 0x10000c784 ; Graph::run(Buffer, int) at graph.cpp 0x10000ecf0: ldr x8, [x0, #32] 0x10000ecf4: str x8, [x24] 0x10000ecf8: ldr w8, [x0, #8] 0x10000ecfc: cmp w8, #1 0x10000ed00: b.lt 0x10000ed20 ; jpcnn_classify_image + 200 at dimensions.h:103 0x10000ed04: add x10, x0, #12 0x10000ed08: orr w9, wzr, #0x1 0x10000ed0c: ldr w11, [x10], #4 0x10000ed10: mul w9, w11, w9 0x10000ed14: sub w8, w8, #1 0x10000ed18: cbnz w8, 0x10000ed0c ; jpcnn_classify_image + 180 [inlined] Dimensions::elementCount() const + 20 at libjpcnn.cpp:135 jpcnn_classify_image + 160 at libjpcnn.cpp:135 0x10000ed1c: b 0x10000ed24 ; jpcnn_classify_image + 204 at libjpcnn.cpp:135 0x10000ed20: orr w9, wzr, #0x1 0x10000ed24: str w9, [x22] 0x10000ed28: cbz w23, 0x10000ed48 ; jpcnn_classify_image + 240 at libjpcnn.cpp:137 0x10000ed2c: str xzr, [x20] 0x10000ed30: ldr w21, [x0, #8] 0x10000ed34: cmp w21, #2 0x10000ed38: b.ge 0x10000ed58 ; jpcnn_classify_image + 256 at libjpcnn.cpp:138 0x10000ed3c: str wzr, [sp, #28] 0x10000ed40: orr w20, wzr, #0x1 0x10000ed44: b 0x10000ede4 ; jpcnn_classify_image + 396 [inlined] Dimensions at dimensions.h:48 jpcnn_classify_image + 396 [inlined] Dimensions at dimensions.h:188 jpcnn_classify_image + 396 [inlined] Dimensions::removeDimensions(int) const + 136 at libjpcnn.cpp:141 jpcnn_classify_image + 260 at libjpcnn.cpp:141 0x10000ed48: ldr x8, [x21, #72] 0x10000ed4c: str x8, [x20] 0x10000ed50: ldr w8, [x21, #80] 0x10000ed54: b 0x10000ee10 ; jpcnn_classify_image + 440 at libjpcnn.cpp:138 0x10000ed58: movz x8, #0 0x10000ed5c: sub w20, w21, #1 0x10000ed60: add x9, x0, #16 0x10000ed64: sub w10, w21, #1 0x10000ed68: sub x11, fp, #92 0x10000ed6c: orr x12, xzr, #0x100000000 0x10000ed70: ldr w13, [x9], #4 0x10000ed74: asr x14, x8, #32 0x10000ed78: str w13, [x11, x14, lsl #2] 0x10000ed7c: add x8, x8, x12 0x10000ed80: sub w10, w10, #1 0x10000ed84: cbnz w10, 0x10000ed70 ; jpcnn_classify_image + 280 [inlined] Dimensions::removeDimensions(int) const + 20 at libjpcnn.cpp:141 jpcnn_classify_image + 260 at libjpcnn.cpp:141 0x10000ed88: cmp w20, #6 0x10000ed8c: b.lt 0x10000edb0 ; jpcnn_classify_image + 344 [inlined] Dimensions + 40 at dimensions.h:88 jpcnn_classify_image + 304 [inlined] Dimensions at dimensions.h:194 jpcnn_classify_image + 304 [inlined] Dimensions::removeDimensions(int) const + 44 at libjpcnn.cpp:141 jpcnn_classify_image + 260 at libjpcnn.cpp:141 0x10000ed90: nop
0x10000ed94: ldr x8, #119508 ; (void
)0x000000019c1b5ce8: stderrp 0x10000ed98: ldr x0, [x8] 0x10000ed9c: movz x8, #5 0x10000eda0: stp x20, x8, [sp] 0x10000eda4: adr x1, #108235 ; "Length too large in Dimensions::Dimensions(): %d, max is %d" 0x10000eda8: nop
0x10000edac: bl 0x100025fa0 ; symbol stub for: fprintf 0x10000edb0: cmp w20, #1 0x10000edb4: b.lt 0x10000ee08 ; jpcnn_classify_image + 432 [inlined] Dimensions at dimensions.h:88 jpcnn_classify_image + 432 [inlined] Dimensions at dimensions.h:194 jpcnn_classify_image + 432 [inlined] Dimensions::removeDimensions(int) const + 172 at libjpcnn.cpp:141 jpcnn_classify_image + 260 at libjpcnn.cpp:141 0x10000edb8: neg w8, w21 0x10000edbc: add x9, sp, #24 0x10000edc0: orr x0, x9, #0x4 0x10000edc4: sub w9, w21, #2 0x10000edc8: orr x10, xzr, #0x4 0x10000edcc: add x9, x10, w9, uxtw #2 0x10000edd0: cmn w8, #6 0x10000edd4: movz x8, #20 0x10000edd8: csel x2, x9, x8, gt 0x10000eddc: sub x1, fp, #92 0x10000ede0: bl 0x100026060 ; symbol stub for: memcpy 0x10000ede4: str w20, [sp, #24] 0x10000ede8: add x8, sp, #24 0x10000edec: orr x9, x8, #0x4 0x10000edf0: orr w8, wzr, #0x1 0x10000edf4: ldr w10, [x9], #4 0x10000edf8: mul w8, w10, w8 0x10000edfc: sub w20, w20, #1 0x10000ee00: cbnz w20, 0x10000edf4 ; jpcnn_classify_image + 412 [inlined] Dimensions::removeDimensions(int) const + 152 at libjpcnn.cpp:141 jpcnn_classify_image + 260 at libjpcnn.cpp:141 0x10000ee04: b 0x10000ee10 ; jpcnn_classify_image + 440 at libjpcnn.cpp:138 0x10000ee08: str w20, [sp, #24] 0x10000ee0c: orr w8, wzr, #0x1 0x10000ee10: str w8, [x19] 0x10000ee14: add x0, sp, #48 0x10000ee18: bl 0x10000dfa4 ; ~PrepareInput at prepareinput.cpp 0x10000ee1c: ldr x8, [x26] 0x10000ee20: ldur x9, [fp, #-72] 0x10000ee24: sub x8, x8, x9 0x10000ee28: cbnz x8, 0x10000ee48 ; jpcnn_classify_image + 496 at libjpcnn.cpp:143 0x10000ee2c: sub sp, fp, #64 0x10000ee30: ldp x26, x25, [sp], #16 0x10000ee34: ldp x24, x23, [sp], #16 0x10000ee38: ldp x22, x21, [sp], #16 0x10000ee3c: ldp x20, x19, [sp], #16 0x10000ee40: ldp fp, lr, [sp], #16 0x10000ee44: ret
0x10000ee48: bl 0x100025eec ; symbol stub for:
stack_chk_fail 0x10000ee4c: mov x19, x0 0x10000ee50: add x8, sp, #48 0x10000ee54: mov x0, x8 0x10000ee58: bl 0x10000dfa4 ; ~PrepareInput at prepareinput.cpp 0x10000ee5c: mov x0, x19 0x10000ee60: bl 0x100025ed4 ; symbol stub for: _Unwind_Resume

maxi-mus commented 9 years ago

OK I think I may have come closer to the source of the problem. I'm playing around with the examples and some what seem to me perfectly normal .jpg images cause the code here https://github.com/jetpacapp/DeepBeliefSDK/tree/master#adding-to-an-existing-ios-application to crash. Here's the URL of an example of a such image: https://generallove.files.wordpress.com/2014/03/hp-desktop-computer-869356.jpg

petewarden commented 9 years ago

Thanks for digging into that! It sounds like something's going wrong with the image reading code. Have you tried re-compiling the framework yourself? That might give you more useful error messages, the project is in https://github.com/jetpacapp/DeepBeliefSDK/tree/gh-pages/source

maxi-mus commented 9 years ago

Hi Pete. I'm not quite sure I understand where I find the framework, and when I do how to compile it...

maxi-mus commented 9 years ago

OK. I think I finally found the solution. Problem was that I was running the whole AVCaptureSession setup stuff before creating the network, so I guess the crash was caused by jpcnn_classify_image running with no network created. Xcode's error messages of course are of no use in figuring this out :)