CICoreMLModelFilter throws “Unsupported engine type”












2















There's this new and still undocumented CICoreMLModelFilter within CoreImage. It takes two parameters:




inputImage - The image to use as an input image. For filters that also use a background image, this is the foreground image.



inputModel - The CoreML model to be used for applying effect on the image.




The idea is pretty simple - take an image, apply style transfer and spit out stylized image.



So I loaded CoreML Model into my test application and tried to pass this model as inputModel key:



guard
let mlFilter = CIFilter(name: "CICoreMLModelFilter")
else {
return nil
}

let model = StarryStyle().model

mlFilter.setValue(workingImage, forKey: "inputImage")
mlFilter.setValue(model, forKey: "inputModel")

guard
let mlResult = mlFilter.outputImage
else {
return nil
}


Whenever I try to run this very simple code I get the following exception:



[Espresso::handle_ex_] exception=Unsupported engine type


Regardless of MLModel I try to load, it always throws with the exception above. I'm running Swift 4.2 on Mojave (10.14).



Did anyone try to play with CoreImage and CoreML?










share|improve this question




















  • 1





    What you're trying to do is probably totally unsupported, but Espresso is the thing that actually runs Core ML models. The "engine type" can be MPS (for using the GPU), ANE (for the new neural engine on the A12), and possibly others. It would be interesting to see what the actual engine type is that is being requested here. Are you running this on an iPhone XS? If not, that might be the explanation.

    – Matthijs Hollemans
    Oct 1 '18 at 8:33











  • Matthijs, thanks for your input but I respectfully disagree. It is perfectly possible to do just that as this has been shown on this WWDC session developer.apple.com/videos/play/wwdc2018/719 (43:20). They loaded CoreML model and passed it to CICoreMLModelFilter to achieve style transfer.

    – Pono
    Oct 1 '18 at 10:34











  • Ah, but if they showed it WWDC then it's not really undocumented. ;-) Did they show it on Mojave on WWDC or on a phone?

    – Matthijs Hollemans
    Oct 2 '18 at 9:02











  • I just tested the filter with my models and it actually works (on an iPhone X). However, it leaks a lot of memory with every call to outputImage and after a few frames the app runs out of memory. It also uses scale-to-fit on the input image to match the model's input size—no smart scaling and cropping as Vision does. I guess you are better off writing your own CIImageProcessorKernel for integrating CoreML models into Core Image.

    – Frank Schlegel
    Nov 17 '18 at 15:40
















2















There's this new and still undocumented CICoreMLModelFilter within CoreImage. It takes two parameters:




inputImage - The image to use as an input image. For filters that also use a background image, this is the foreground image.



inputModel - The CoreML model to be used for applying effect on the image.




The idea is pretty simple - take an image, apply style transfer and spit out stylized image.



So I loaded CoreML Model into my test application and tried to pass this model as inputModel key:



guard
let mlFilter = CIFilter(name: "CICoreMLModelFilter")
else {
return nil
}

let model = StarryStyle().model

mlFilter.setValue(workingImage, forKey: "inputImage")
mlFilter.setValue(model, forKey: "inputModel")

guard
let mlResult = mlFilter.outputImage
else {
return nil
}


Whenever I try to run this very simple code I get the following exception:



[Espresso::handle_ex_] exception=Unsupported engine type


Regardless of MLModel I try to load, it always throws with the exception above. I'm running Swift 4.2 on Mojave (10.14).



Did anyone try to play with CoreImage and CoreML?










share|improve this question




















  • 1





    What you're trying to do is probably totally unsupported, but Espresso is the thing that actually runs Core ML models. The "engine type" can be MPS (for using the GPU), ANE (for the new neural engine on the A12), and possibly others. It would be interesting to see what the actual engine type is that is being requested here. Are you running this on an iPhone XS? If not, that might be the explanation.

    – Matthijs Hollemans
    Oct 1 '18 at 8:33











  • Matthijs, thanks for your input but I respectfully disagree. It is perfectly possible to do just that as this has been shown on this WWDC session developer.apple.com/videos/play/wwdc2018/719 (43:20). They loaded CoreML model and passed it to CICoreMLModelFilter to achieve style transfer.

    – Pono
    Oct 1 '18 at 10:34











  • Ah, but if they showed it WWDC then it's not really undocumented. ;-) Did they show it on Mojave on WWDC or on a phone?

    – Matthijs Hollemans
    Oct 2 '18 at 9:02











  • I just tested the filter with my models and it actually works (on an iPhone X). However, it leaks a lot of memory with every call to outputImage and after a few frames the app runs out of memory. It also uses scale-to-fit on the input image to match the model's input size—no smart scaling and cropping as Vision does. I guess you are better off writing your own CIImageProcessorKernel for integrating CoreML models into Core Image.

    – Frank Schlegel
    Nov 17 '18 at 15:40














2












2








2


1






There's this new and still undocumented CICoreMLModelFilter within CoreImage. It takes two parameters:




inputImage - The image to use as an input image. For filters that also use a background image, this is the foreground image.



inputModel - The CoreML model to be used for applying effect on the image.




The idea is pretty simple - take an image, apply style transfer and spit out stylized image.



So I loaded CoreML Model into my test application and tried to pass this model as inputModel key:



guard
let mlFilter = CIFilter(name: "CICoreMLModelFilter")
else {
return nil
}

let model = StarryStyle().model

mlFilter.setValue(workingImage, forKey: "inputImage")
mlFilter.setValue(model, forKey: "inputModel")

guard
let mlResult = mlFilter.outputImage
else {
return nil
}


Whenever I try to run this very simple code I get the following exception:



[Espresso::handle_ex_] exception=Unsupported engine type


Regardless of MLModel I try to load, it always throws with the exception above. I'm running Swift 4.2 on Mojave (10.14).



Did anyone try to play with CoreImage and CoreML?










share|improve this question
















There's this new and still undocumented CICoreMLModelFilter within CoreImage. It takes two parameters:




inputImage - The image to use as an input image. For filters that also use a background image, this is the foreground image.



inputModel - The CoreML model to be used for applying effect on the image.




The idea is pretty simple - take an image, apply style transfer and spit out stylized image.



So I loaded CoreML Model into my test application and tried to pass this model as inputModel key:



guard
let mlFilter = CIFilter(name: "CICoreMLModelFilter")
else {
return nil
}

let model = StarryStyle().model

mlFilter.setValue(workingImage, forKey: "inputImage")
mlFilter.setValue(model, forKey: "inputModel")

guard
let mlResult = mlFilter.outputImage
else {
return nil
}


Whenever I try to run this very simple code I get the following exception:



[Espresso::handle_ex_] exception=Unsupported engine type


Regardless of MLModel I try to load, it always throws with the exception above. I'm running Swift 4.2 on Mojave (10.14).



Did anyone try to play with CoreImage and CoreML?







swift core-graphics core-image coreml






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 30 '18 at 10:02







Pono

















asked Sep 30 '18 at 9:51









PonoPono

5,09964453




5,09964453








  • 1





    What you're trying to do is probably totally unsupported, but Espresso is the thing that actually runs Core ML models. The "engine type" can be MPS (for using the GPU), ANE (for the new neural engine on the A12), and possibly others. It would be interesting to see what the actual engine type is that is being requested here. Are you running this on an iPhone XS? If not, that might be the explanation.

    – Matthijs Hollemans
    Oct 1 '18 at 8:33











  • Matthijs, thanks for your input but I respectfully disagree. It is perfectly possible to do just that as this has been shown on this WWDC session developer.apple.com/videos/play/wwdc2018/719 (43:20). They loaded CoreML model and passed it to CICoreMLModelFilter to achieve style transfer.

    – Pono
    Oct 1 '18 at 10:34











  • Ah, but if they showed it WWDC then it's not really undocumented. ;-) Did they show it on Mojave on WWDC or on a phone?

    – Matthijs Hollemans
    Oct 2 '18 at 9:02











  • I just tested the filter with my models and it actually works (on an iPhone X). However, it leaks a lot of memory with every call to outputImage and after a few frames the app runs out of memory. It also uses scale-to-fit on the input image to match the model's input size—no smart scaling and cropping as Vision does. I guess you are better off writing your own CIImageProcessorKernel for integrating CoreML models into Core Image.

    – Frank Schlegel
    Nov 17 '18 at 15:40














  • 1





    What you're trying to do is probably totally unsupported, but Espresso is the thing that actually runs Core ML models. The "engine type" can be MPS (for using the GPU), ANE (for the new neural engine on the A12), and possibly others. It would be interesting to see what the actual engine type is that is being requested here. Are you running this on an iPhone XS? If not, that might be the explanation.

    – Matthijs Hollemans
    Oct 1 '18 at 8:33











  • Matthijs, thanks for your input but I respectfully disagree. It is perfectly possible to do just that as this has been shown on this WWDC session developer.apple.com/videos/play/wwdc2018/719 (43:20). They loaded CoreML model and passed it to CICoreMLModelFilter to achieve style transfer.

    – Pono
    Oct 1 '18 at 10:34











  • Ah, but if they showed it WWDC then it's not really undocumented. ;-) Did they show it on Mojave on WWDC or on a phone?

    – Matthijs Hollemans
    Oct 2 '18 at 9:02











  • I just tested the filter with my models and it actually works (on an iPhone X). However, it leaks a lot of memory with every call to outputImage and after a few frames the app runs out of memory. It also uses scale-to-fit on the input image to match the model's input size—no smart scaling and cropping as Vision does. I guess you are better off writing your own CIImageProcessorKernel for integrating CoreML models into Core Image.

    – Frank Schlegel
    Nov 17 '18 at 15:40








1




1





What you're trying to do is probably totally unsupported, but Espresso is the thing that actually runs Core ML models. The "engine type" can be MPS (for using the GPU), ANE (for the new neural engine on the A12), and possibly others. It would be interesting to see what the actual engine type is that is being requested here. Are you running this on an iPhone XS? If not, that might be the explanation.

– Matthijs Hollemans
Oct 1 '18 at 8:33





What you're trying to do is probably totally unsupported, but Espresso is the thing that actually runs Core ML models. The "engine type" can be MPS (for using the GPU), ANE (for the new neural engine on the A12), and possibly others. It would be interesting to see what the actual engine type is that is being requested here. Are you running this on an iPhone XS? If not, that might be the explanation.

– Matthijs Hollemans
Oct 1 '18 at 8:33













Matthijs, thanks for your input but I respectfully disagree. It is perfectly possible to do just that as this has been shown on this WWDC session developer.apple.com/videos/play/wwdc2018/719 (43:20). They loaded CoreML model and passed it to CICoreMLModelFilter to achieve style transfer.

– Pono
Oct 1 '18 at 10:34





Matthijs, thanks for your input but I respectfully disagree. It is perfectly possible to do just that as this has been shown on this WWDC session developer.apple.com/videos/play/wwdc2018/719 (43:20). They loaded CoreML model and passed it to CICoreMLModelFilter to achieve style transfer.

– Pono
Oct 1 '18 at 10:34













Ah, but if they showed it WWDC then it's not really undocumented. ;-) Did they show it on Mojave on WWDC or on a phone?

– Matthijs Hollemans
Oct 2 '18 at 9:02





Ah, but if they showed it WWDC then it's not really undocumented. ;-) Did they show it on Mojave on WWDC or on a phone?

– Matthijs Hollemans
Oct 2 '18 at 9:02













I just tested the filter with my models and it actually works (on an iPhone X). However, it leaks a lot of memory with every call to outputImage and after a few frames the app runs out of memory. It also uses scale-to-fit on the input image to match the model's input size—no smart scaling and cropping as Vision does. I guess you are better off writing your own CIImageProcessorKernel for integrating CoreML models into Core Image.

– Frank Schlegel
Nov 17 '18 at 15:40





I just tested the filter with my models and it actually works (on an iPhone X). However, it leaks a lot of memory with every call to outputImage and after a few frames the app runs out of memory. It also uses scale-to-fit on the input image to match the model's input size—no smart scaling and cropping as Vision does. I guess you are better off writing your own CIImageProcessorKernel for integrating CoreML models into Core Image.

– Frank Schlegel
Nov 17 '18 at 15:40












2 Answers
2






active

oldest

votes


















0














Im running into this error on Mac OS 10.14 - on a model that works fine on iOS 12 sans errors, and on earlier versions of Mac OS - 10.13. Initially I thought this was related to floating point quantization, but ive tried this on non quantized float 32 models, and on different devices, and get it for models that:




  • Output / run inference fine

  • Use standard CoreML / Vision API's

  • Run on integrated or discreet GPUs

  • on iMac Pro AMD GPUs

  • on MBP Nvidia GPUs


im not sure if this is just some internal exception that's handled - on AMD, I get a slightly different error ;



[Espresso:handle_ex_] exception=<private>



Im beginning to think it's innocuous?






share|improve this answer































    0














    Adding an interesting answer/discovery because the error message is the same, but I am not using anything related to the CoreML API (or so I thought).




    WatchKit Extension[7896:536979] [espresso] [Espresso::handle_ex_] exception=Unsupported engine type




    I am getting this message when I am using the text input controller. Specifically presentTextInputController.



    enter image description here



    I believe this is simply appearing because the CoreML engine is running on the simulator. At least in the case of the text input controller this is the apparent reason for this message.



    The text input controller which is a controller we get for free, includes the Scribble text input. It's obviously discreetly piggybacking on the same CoreML engine otherwise it wouldn't be able to recognize scribbles.



    There is no way to disable Scribble input to actually test this theory. Dictation and Scribble are enabled by default. You can only disable emoji and/or animatedEmoji. But it is pretty evident this is what is happening.






    share|improve this answer

























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52576753%2fcicoremlmodelfilter-throws-unsupported-engine-type%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Im running into this error on Mac OS 10.14 - on a model that works fine on iOS 12 sans errors, and on earlier versions of Mac OS - 10.13. Initially I thought this was related to floating point quantization, but ive tried this on non quantized float 32 models, and on different devices, and get it for models that:




      • Output / run inference fine

      • Use standard CoreML / Vision API's

      • Run on integrated or discreet GPUs

      • on iMac Pro AMD GPUs

      • on MBP Nvidia GPUs


      im not sure if this is just some internal exception that's handled - on AMD, I get a slightly different error ;



      [Espresso:handle_ex_] exception=<private>



      Im beginning to think it's innocuous?






      share|improve this answer




























        0














        Im running into this error on Mac OS 10.14 - on a model that works fine on iOS 12 sans errors, and on earlier versions of Mac OS - 10.13. Initially I thought this was related to floating point quantization, but ive tried this on non quantized float 32 models, and on different devices, and get it for models that:




        • Output / run inference fine

        • Use standard CoreML / Vision API's

        • Run on integrated or discreet GPUs

        • on iMac Pro AMD GPUs

        • on MBP Nvidia GPUs


        im not sure if this is just some internal exception that's handled - on AMD, I get a slightly different error ;



        [Espresso:handle_ex_] exception=<private>



        Im beginning to think it's innocuous?






        share|improve this answer


























          0












          0








          0







          Im running into this error on Mac OS 10.14 - on a model that works fine on iOS 12 sans errors, and on earlier versions of Mac OS - 10.13. Initially I thought this was related to floating point quantization, but ive tried this on non quantized float 32 models, and on different devices, and get it for models that:




          • Output / run inference fine

          • Use standard CoreML / Vision API's

          • Run on integrated or discreet GPUs

          • on iMac Pro AMD GPUs

          • on MBP Nvidia GPUs


          im not sure if this is just some internal exception that's handled - on AMD, I get a slightly different error ;



          [Espresso:handle_ex_] exception=<private>



          Im beginning to think it's innocuous?






          share|improve this answer













          Im running into this error on Mac OS 10.14 - on a model that works fine on iOS 12 sans errors, and on earlier versions of Mac OS - 10.13. Initially I thought this was related to floating point quantization, but ive tried this on non quantized float 32 models, and on different devices, and get it for models that:




          • Output / run inference fine

          • Use standard CoreML / Vision API's

          • Run on integrated or discreet GPUs

          • on iMac Pro AMD GPUs

          • on MBP Nvidia GPUs


          im not sure if this is just some internal exception that's handled - on AMD, I get a slightly different error ;



          [Espresso:handle_ex_] exception=<private>



          Im beginning to think it's innocuous?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 19 '18 at 19:45









          vadevade

          8311




          8311

























              0














              Adding an interesting answer/discovery because the error message is the same, but I am not using anything related to the CoreML API (or so I thought).




              WatchKit Extension[7896:536979] [espresso] [Espresso::handle_ex_] exception=Unsupported engine type




              I am getting this message when I am using the text input controller. Specifically presentTextInputController.



              enter image description here



              I believe this is simply appearing because the CoreML engine is running on the simulator. At least in the case of the text input controller this is the apparent reason for this message.



              The text input controller which is a controller we get for free, includes the Scribble text input. It's obviously discreetly piggybacking on the same CoreML engine otherwise it wouldn't be able to recognize scribbles.



              There is no way to disable Scribble input to actually test this theory. Dictation and Scribble are enabled by default. You can only disable emoji and/or animatedEmoji. But it is pretty evident this is what is happening.






              share|improve this answer






























                0














                Adding an interesting answer/discovery because the error message is the same, but I am not using anything related to the CoreML API (or so I thought).




                WatchKit Extension[7896:536979] [espresso] [Espresso::handle_ex_] exception=Unsupported engine type




                I am getting this message when I am using the text input controller. Specifically presentTextInputController.



                enter image description here



                I believe this is simply appearing because the CoreML engine is running on the simulator. At least in the case of the text input controller this is the apparent reason for this message.



                The text input controller which is a controller we get for free, includes the Scribble text input. It's obviously discreetly piggybacking on the same CoreML engine otherwise it wouldn't be able to recognize scribbles.



                There is no way to disable Scribble input to actually test this theory. Dictation and Scribble are enabled by default. You can only disable emoji and/or animatedEmoji. But it is pretty evident this is what is happening.






                share|improve this answer




























                  0












                  0








                  0







                  Adding an interesting answer/discovery because the error message is the same, but I am not using anything related to the CoreML API (or so I thought).




                  WatchKit Extension[7896:536979] [espresso] [Espresso::handle_ex_] exception=Unsupported engine type




                  I am getting this message when I am using the text input controller. Specifically presentTextInputController.



                  enter image description here



                  I believe this is simply appearing because the CoreML engine is running on the simulator. At least in the case of the text input controller this is the apparent reason for this message.



                  The text input controller which is a controller we get for free, includes the Scribble text input. It's obviously discreetly piggybacking on the same CoreML engine otherwise it wouldn't be able to recognize scribbles.



                  There is no way to disable Scribble input to actually test this theory. Dictation and Scribble are enabled by default. You can only disable emoji and/or animatedEmoji. But it is pretty evident this is what is happening.






                  share|improve this answer















                  Adding an interesting answer/discovery because the error message is the same, but I am not using anything related to the CoreML API (or so I thought).




                  WatchKit Extension[7896:536979] [espresso] [Espresso::handle_ex_] exception=Unsupported engine type




                  I am getting this message when I am using the text input controller. Specifically presentTextInputController.



                  enter image description here



                  I believe this is simply appearing because the CoreML engine is running on the simulator. At least in the case of the text input controller this is the apparent reason for this message.



                  The text input controller which is a controller we get for free, includes the Scribble text input. It's obviously discreetly piggybacking on the same CoreML engine otherwise it wouldn't be able to recognize scribbles.



                  There is no way to disable Scribble input to actually test this theory. Dictation and Scribble are enabled by default. You can only disable emoji and/or animatedEmoji. But it is pretty evident this is what is happening.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 22 '18 at 12:40

























                  answered Nov 22 '18 at 12:03









                  tymactymac

                  8,19432236




                  8,19432236






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52576753%2fcicoremlmodelfilter-throws-unsupported-engine-type%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Paul Cézanne

                      UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

                      Angular material date-picker (MatDatepicker) auto completes the date on focus out