Giter Club home page Giter Club logo

Comments (5)

skottmckay avatar skottmckay commented on September 27, 2024 1

If you want the model to gracefully handle zero matches it would have to have an If node to do conditional processing of the bounding boxes. Probably simpler to just ignore the error.

You have to keep ortEnv alive for longer than the session.

from onnxruntime.

skottmckay avatar skottmckay commented on September 27, 2024

If there are zero elements it sounds like there were either no matches in your input image, or the NonMaxSuppression parameters were too strict and resulted in no matches being selected.

CoreML doesn't handle this sort of empty data scenario, but given there are no matches, you could gracefully handle this specific error as an expected result. the output if CoreML did handle empty tensors would still be an empty result set.

from onnxruntime.

pbanavara avatar pbanavara commented on September 27, 2024

Hi Scott, Thank you. There are no matches in the input image as it doesn't contain any people but the model Does this mean I have to fix the ONNX conversion code to not produce the empty intermediate tensor ? For now I am just gonna ignore this error and continue with processing as I have no idea how to fix the ONNX code. Please close this ticket if that's appropriate.

from onnxruntime.

pbanavara avatar pbanavara commented on September 27, 2024

Hi @skottmckay This problem is resolved. However the application crashes when I move the app to background or click the back button from the viewController. I see this error message, just before the app crashes. Do you have some idea on what's causing this error ? I have used the Apple profiling tools to debug the crash but so far no luck. If I get rid of the onnx code, the app doesn't crash. Thank you and appreciate all your help.

Particularly in the below - sourceURL= (null) is what I thought is relevant. But how can this be as the model is loaded and present in the URL.

Here is the Onnx model initialization code in the viewDidLoad method of the UIViewController for reference.

func getOrtSessionFromModelName() {
        guard let modelPath = Bundle.main.path(forResource: "yolov8n-pose-pre", ofType: "onnx") else {
            fatalError("Model file not found")
        }
        do {
            
            let ortEnv = try ORTEnv(loggingLevel: ORTLoggingLevel.verbose)
            let ortSessionOptions = try ORTSessionOptions()
            let ortCoreMlSessionOptions = ORTCoreMLExecutionProviderOptions()
            try ortSessionOptions.appendCoreMLExecutionProvider(with: ortCoreMlSessionOptions)
            try ortSessionOptions.registerCustomOps(functionPointer: RegisterCustomOps) // Register the bridging-header in Build settings
            self.ortSession = try ORTSession(
                env: ortEnv, modelPath: modelPath, sessionOptions: ortSessionOptions)
            
        } catch {
            NSLog("Model initialization error \(error)")
            
        }
        
    }

Onnx error

doUnloadModel:options:qos:error:: model=_ANEModel: { modelURL=file:///var/mobile/Containers/Data/Application/301E1763-54D6-4431-9B1A-3294A056FBA7/tmp/6A93CDD5-8D34-44F2-A691-95411FDEB8CE-37346-000007A9FCF753F7.mlmodelc/ : sourceURL= (null) : key={"isegment":0,"inputs":{"_ppp10_ratios":{"shape":[1,1,1,1,1]},"_ppp10_restored_boxes":{"shape":[4,1,1,1,1]}},"outputs":{"_ppp10_scaled_boxes":{"shape":[4,1,1,1,1]}}} : identifierSource=0 : cacheURLIdentifier=7A231F7B75EAC6E19B6CEDE90D4C3D277988F5D3E8FA9C863F3BCC3B2D5BA85E_EF23976A43D6FF8A9AEBDC07236D5C309D2A0CBA853E0840F49DA977C90899F2 : string_id=0x00000000 : program=_ANEProgramForEvaluation: { programHandle=8426675537938 : intermediateBufferHandle=0 : queueDepth=127 } : state=3 : programHandle=8426675537938 : intermediateBufferHandle=0 : queueDepth=127 : attr={
    ANEFModelDescription =     {
        ANEFModelInput16KAlignmentArray =         (
        );
        ANEFModelOutput16KAlignmentArray =         (
        );
        ANEFModelProcedures =         (
                        {
                ANEFModelInputSymbolIndexArray =                 (
                    0,
                    1
                );
                ANEFModelOutputSymbolIndexArray =                 (
                    0
                );
                ANEFModelProcedureID = 0;
            }
        );
        kANEFModelInputSymbolsArrayKey =         (
            52f4d8d25e7baac36ed8c8986c297c11,
            9768afc0313486df07fc876a87706597
        );
        kANEFModelOutputSymbolsArrayKey =         (
            "5ccf048a34df2cee4c57251c6e60c479@output"
        );
        kANEFModelProcedureNameToIDMapKey =         {
            net = 0;
        };
    };
    NetworkStatusList =     (
                {
            LiveInputList =             (
                                {
                    BatchStride = 64;
                    Batches = 1;
                    Channels = 1;
                    Depth = 1;
                    DepthStride = 64;
                    Height = 1;
                    Interleave = 1;
                    Name = 52f4d8d25e7baac36ed8c8986c297c11;
                    PlaneCount = 1;
                    PlaneStride = 64;
                    RowStride = 64;
                    Symbol = 52f4d8d25e7baac36ed8c8986c297c11;
                    Type = Float16;
                    Width = 4;
                },
                                {
                    BatchStride = 64;
                    Batches = 1;
                    Channels = 1;
                    Depth = 1;
                    DepthStride = 64;
                    Height = 1;
                    Interleave = 1;
                    Name = 9768afc0313486df07fc876a87706597;
                    PlaneCount = 1;
                    PlaneStride = 64;
                    RowStride = 64;
                    Symbol = 9768afc0313486df07fc876a87706597;
                    Type = Float16;
                    Width = 1;
                }
            );
            LiveOutputList =             (
                                {
                    BatchStride = 64;
                    Batches = 1;
                    Channels = 1;
                    Depth = 1;
                    DepthStride = 64;
                    Height = 1;
                    Interleave = 1;
                    Name = "5ccf048a34df2cee4c57251c6e60c479@output";
                    PlaneCount = 1;
                    PlaneStride = 64;
                    RowStride = 64;
                    Symbol = "5ccf048a34df2cee4c57251c6e60c479@output";
                    Type = Float16;
                    Width = 4;
                }
            );
            Name = net;
        }
    );
} : perfStatsMask=0}  was not loaded by the client.`

The application crash message
image

from onnxruntime.

pbanavara avatar pbanavara commented on September 27, 2024

Closing this issue. Thank @skottmckay

from onnxruntime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.