roymacdonald / ofxVision

openFrameworks addon for using Apple's Vision Framework
6 stars 0 forks source link

compile error for object detection example #1

Open stephanschulz opened 5 months ago

stephanschulz commented 5 months ago

Screen Shot 2024-04-10 at 4 28 47 PM Screen Shot 2024-04-10 at 4 29 00 PM

2024-04-10 16:28:39.905725-0400 example-ObjectDetection[21829:4300551] Metal API Validation Enabled
2024-04-10 16:28:48.657806-0400 example-ObjectDetection[21829:4300551] +[MLModel compileModelAtURL:completionHandler:]: unrecognized selector sent to class 0x1eddadd68
2024-04-10 16:28:48.658348-0400 example-ObjectDetection[21829:4300551] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[MLModel compileModelAtURL:completionHandler:]: unrecognized selector sent to class 0x1eddadd68'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000195489138 __exceptionPreprocess + 240
    1   libobjc.A.dylib                     0x00000001951d3e04 objc_exception_throw + 60
    2   CoreFoundation                      0x000000019551ce18 __CFExceptionProem + 0
    3   CoreFoundation                      0x00000001953e8464 ___forwarding___ + 1764
    4   CoreFoundation                      0x00000001953e7cc0 _CF_forwarding_prep_0 + 96
    5   example-ObjectDetection             0x000000010032fbcc -[ObjectRecognition initWithModelPath:] + 236
    6   example-ObjectDetection             0x0000000100330794 _ZN18ofxVisionDetection9loadModelERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 76
    7   example-ObjectDetection             0x0000000100328024 _ZN5ofApp5setupEv + 184
    8   example-ObjectDetection             0x000000010054a238 _ZNSt3__110__function6__funcIZN7ofEventI11ofEventArgsNS_15recursive_mutexEE13make_functionI9ofBaseAppEENS_10shared_ptrIN2of4priv8FunctionIS3_S4_EEEEPT_MSE_FvRS3_EiEUlPKvSG_E_NS_9allocatorISL_EEFbSK_SG_EEclEOSK_SG_ + 40
    9   example-ObjectDetection             0x000000010054eb8c _ZN7ofEventI11ofEventArgsNSt3__115recursive_mutexEE6notifyERS0_ + 148
    10  example-ObjectDetection             0x0000000100327c00 main + 260
    11  dyld                                0x0000000100de908c start + 520
)
2024-04-10 16:28:48.658491-0400 example-ObjectDetection[21829:4300551] [General] An uncaught exception was raised
2024-04-10 16:28:48.658516-0400 example-ObjectDetection[21829:4300551] [General] +[MLModel compileModelAtURL:completionHandler:]: unrecognized selector sent to class 0x1eddadd68
2024-04-10 16:28:48.658554-0400 example-ObjectDetection[21829:4300551] [General] (
    0   CoreFoundation                      0x0000000195489138 __exceptionPreprocess + 240
    1   libobjc.A.dylib                     0x00000001951d3e04 objc_exception_throw + 60
    2   CoreFoundation                      0x000000019551ce18 __CFExceptionProem + 0
    3   CoreFoundation                      0x00000001953e8464 ___forwarding___ + 1764
    4   CoreFoundation                      0x00000001953e7cc0 _CF_forwarding_prep_0 + 96
    5   example-ObjectDetection             0x000000010032fbcc -[ObjectRecognition initWithModelPath:] + 236
    6   example-ObjectDetection             0x0000000100330794 _ZN18ofxVisionDetection9loadModelERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 76
    7   example-ObjectDetection             0x0000000100328024 _ZN5ofApp5setupEv + 184
    8   example-ObjectDetection             0x000000010054a238 _ZNSt3__110__function6__funcIZN7ofEventI11ofEventArgsNS_15recursive_mutexEE13make_functionI9ofBaseAppEENS_10shared_ptrIN2of4priv8FunctionIS3_S4_EEEEPT_MSE_FvRS3_EiEUlPKvSG_E_NS_9allocatorISL_EEFbSK_SG_EEclEOSK_SG_ + 40
    9   example-ObjectDetection             0x000000010054eb8c _ZN7ofEventI11ofEventArgsNSt3__115recursive_mutexEE6notifyERS0_ + 148
    10  example-ObjectDetection             0x0000000100327c00 main + 260
    11  dyld                                0x0000000100de908c start + 520
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[MLModel compileModelAtURL:completionHandler:]: unrecognized selector sent to class 0x1eddadd68'
terminating with uncaught exception of type NSException
(lldb) 
roymacdonald commented 5 months ago

Which macos version are you using? That function is only for macos13 or newer. There is another version for older macos. I will add it with a #ifdef

stephanschulz commented 5 months ago

ah. I am on 12.6.8 thank you for adding the #ifdef

roymacdonald commented 5 months ago

@stephanschulz I just updated a fix for this. Please try it and let me know

stephanschulz commented 5 months ago

Screen Shot 2024-04-10 at 7 33 21 PM Screen Shot 2024-04-10 at 7 33 25 PM Screen Shot 2024-04-10 at 7 33 28 PM

2024-04-10 19:35:58.699570-0400 example-ObjectDetection[36228:4483459] Metal API Validation Enabled
2024-04-10 19:36:00.810530-0400 example-ObjectDetection[36228:4483459] fileURLWithPath: /Applications/of_v0.12.0_osx_release/addons/ofxVision/example-ObjectDetection/bin/data/YOLOv3.mlmodel
2024-04-10 19:36:00.810598-0400 example-ObjectDetection[36228:4483459] +[MLModel compileModelAtURL:completionHandler:]: unrecognized selector sent to class 0x1eddadd68
2024-04-10 19:36:00.810922-0400 example-ObjectDetection[36228:4483459] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[MLModel compileModelAtURL:completionHandler:]: unrecognized selector sent to class 0x1eddadd68'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000195489138 __exceptionPreprocess + 240
    1   libobjc.A.dylib                     0x00000001951d3e04 objc_exception_throw + 60
    2   CoreFoundation                      0x000000019551ce18 __CFExceptionProem + 0
    3   CoreFoundation                      0x00000001953e8464 ___forwarding___ + 1764
    4   CoreFoundation                      0x00000001953e7cc0 _CF_forwarding_prep_0 + 96
    5   example-ObjectDetection             0x000000010003bbd0 -[ObjectRecognition initWithModelPath:] + 252
    6   example-ObjectDetection             0x000000010003c794 _ZN18ofxVisionDetection9loadModelERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 76
    7   example-ObjectDetection             0x0000000100034018 _ZN5ofApp5setupEv + 184
    8   example-ObjectDetection             0x0000000100256238 _ZNSt3__110__function6__funcIZN7ofEventI11ofEventArgsNS_15recursive_mutexEE13make_functionI9ofBaseAppEENS_10shared_ptrIN2of4priv8FunctionIS3_S4_EEEEPT_MSE_FvRS3_EiEUlPKvSG_E_NS_9allocatorISL_EEFbSK_SG_EEclEOSK_SG_ + 40
    9   example-ObjectDetection             0x000000010025ab8c _ZN7ofEventI11ofEventArgsNSt3__115recursive_mutexEE6notifyERS0_ + 148
    10  example-ObjectDetection             0x0000000100033bf4 main + 260
    11  dyld                                0x000000010086108c start + 520
)
2024-04-10 19:36:00.818922-0400 example-ObjectDetection[36228:4483459] [General] An uncaught exception was raised
2024-04-10 19:36:00.818951-0400 example-ObjectDetection[36228:4483459] [General] +[MLModel compileModelAtURL:completionHandler:]: unrecognized selector sent to class 0x1eddadd68
2024-04-10 19:36:00.818988-0400 example-ObjectDetection[36228:4483459] [General] (
    0   CoreFoundation                      0x0000000195489138 __exceptionPreprocess + 240
    1   libobjc.A.dylib                     0x00000001951d3e04 objc_exception_throw + 60
    2   CoreFoundation                      0x000000019551ce18 __CFExceptionProem + 0
    3   CoreFoundation                      0x00000001953e8464 ___forwarding___ + 1764
    4   CoreFoundation                      0x00000001953e7cc0 _CF_forwarding_prep_0 + 96
    5   example-ObjectDetection             0x000000010003bbd0 -[ObjectRecognition initWithModelPath:] + 252
    6   example-ObjectDetection             0x000000010003c794 _ZN18ofxVisionDetection9loadModelERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 76
    7   example-ObjectDetection             0x0000000100034018 _ZN5ofApp5setupEv + 184
    8   example-ObjectDetection             0x0000000100256238 _ZNSt3__110__function6__funcIZN7ofEventI11ofEventArgsNS_15recursive_mutexEE13make_functionI9ofBaseAppEENS_10shared_ptrIN2of4priv8FunctionIS3_S4_EEEEPT_MSE_FvRS3_EiEUlPKvSG_E_NS_9allocatorISL_EEFbSK_SG_EEclEOSK_SG_ + 40
    9   example-ObjectDetection             0x000000010025ab8c _ZN7ofEventI11ofEventArgsNSt3__115recursive_mutexEE6notifyERS0_ + 148
    10  example-ObjectDetection             0x0000000100033bf4 main + 260
    11  dyld                                0x000000010086108c start + 520
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[MLModel compileModelAtURL:completionHandler:]: unrecognized selector sent to class 0x1eddadd68'
terminating with uncaught exception of type NSException
(lldb) 
stephanschulz commented 5 months ago

the frameworks seem to be linked correctly. the minimum dev is macOS 12 Screen Shot 2024-04-10 at 7 40 38 PM

stephanschulz commented 5 months ago

maybe it is not possible to run the object detector in macOS 12?

'compileModelAtURL:completionHandler:' is only available on macOS 13.0 or newer

Screen Shot 2024-04-10 at 7 46 06 PM

stephanschulz commented 5 months ago

I can confirm that on a Mac mini with macOS 13.4 the app compiles and runs. right now I am not able to really test if it successfully detects anything because my remote machine is in a dark room :(

Screen Shot 2024-04-10 at 7 57 23 PM

roymacdonald commented 5 months ago

ok. I just removed the #ifdef so now using the deprecated function instead which should work with macos12

stephanschulz commented 5 months ago

success. I can confirm it works on macOS 12 love it. thanks roy! Screen Shot 2024-04-11 at 5 48 08 AM