-
Notifications
You must be signed in to change notification settings - Fork 190
ImageSegmentation crashes on iPhone and works on simulators #83
Comments
I get this error too:
|
Okay so I got this working, and i'm not sure if my thinking is exactly correct.
I guess that prevents the app from crashing due to memory on the way into the TorchModule.
But it works! 🎉 My changes are here. @xta0 any chance the above PR could be merged? And what do you think about this remaining bug? I can open a PR if I know what changes are desired but its definitely broken currently which is a little sad considering these TorchScript |
@madhavajay I don't follow where you are allocating the colours to the buffer for the classes, in your fix you return the data without mapping to the class detection... can you steer me to where you've allocated the class map? |
@StuvX my code doesnt change that it just changes the return type from the objective-c function:
The way the classes are assigned is by comparing them and setting one of three color channels RGB in the image if they are the max:
|
@madhavajay Forgive me, my objective-c is not great. you also change 'segmentImage' to return 'data', but your call assigns the colours to 'buffer' - is it because buffer is a pointer to data, and the update call (e.g,. buffer[n] = 255) is updating data[n]? |
@StuvX Yes, its the same memory so I left the C code as it is, and just made sure that the return type is the NSObject so that Objective-C manages the memory and its survival after the function ends using ARC. |
@madhavajay Thank you so much! You just made my day. |
I have tested ImageSegmentation on iPhone 13 pro and iPhone 12 pro max. It crashed as follows:
The text was updated successfully, but these errors were encountered: