简体   繁体   English

隐藏CoreML模型(.mlmodel)文件

[英]Hiding CoreML model (.mlmodel) files

I am working on a project which involves adding AI object detection capabilities to an existing iOS APP. 我正在从事一个项目,该项目涉及向现有iOS APP添加AI对象检测功能。 I was able to train my own DNN models and converted to the CoreML's .mlmodel format. 我能够训练自己的DNN模型并转换为CoreML的.mlmodel格式。

Now I need to transfer my work which includes the .mlmodel files to another developer for integration. 现在,我需要将包括.mlmodel文件的工作转移给另一个开发人员进行集成。 However, I don't want them to use my trained .mlmodel files outside of this project (according to contract). 但是,我不希望他们在该项目之外使用我训练有素的.mlmodel文件(根据合同)。 Is there any way that I can do to just "hide" the .mlmodel files so they can only be used for this particular APP and can't be simply copied and saved for other uses? 我有什么办法可以只“隐藏” .mlmodel文件,以便它们只能用于此特定的APP,而不能简单地复制和保存以用于其他用途?

I have done some quick research on iOS library and framework, but I am still not sure if that's the solution I am looking for. 我已经对iOS库和框架进行了一些快速研究,但是我仍然不确定这是否是我想要的解决方案。

Nope. 不。 Once someone has access to your mlmodel file or the compiled version, mlmodelc, they can use it elsewhere. 一旦有人可以访问您的mlmodel文件或编译版本mlmodelc,他们就可以在其他地方使用它。

For example, you can download an app from the App Store, look inside the IPA file, copy their mlmodelc folder into your own app, and start using the model right away. 例如,您可以从App Store下载一个应用程序,查看IPA文件内部,将其mlmodelc文件夹复制到您自己的应用程序中,然后立即开始使用该模型。

To prevent outsiders from stealing your model, you can encrypt the model (just like you'd encrypt any other file) but that only works if you can hide the decryption key. 为了防止外部人窃取您的模型,您可以对模型进行加密(就像对其他文件进行加密一样),但这仅在您可以隐藏解密密钥的情况下才有效。 You can also add a custom layer to the model, so that it becomes useless without the code for this custom layer. 您还可以在模型中添加一个自定义层,这样,如果没有该自定义层的代码,它就变得无用。

However, those solutions don't work if you're hiring an external developer to work on your app because they will -- out of necessity -- need to have access to these decryption keys and source code files. 但是,如果您雇用外部开发人员来处理您的应用程序,那么这些解决方案将不起作用,因为它们(出于必要)将需要访问这些解密密钥和源代码文件。

I'm not sure what exactly you want this other developer to do, but if you don't trust them, then: 我不确定您希望其他开发人员真正做什么,但是如果您不信任他们,那么:

  1. get a new developer that you do trust, 得到您信任的新开发者,
  2. be prepared to enforce the contract, or 准备执行合同,或
  3. give them a version of your mlmodel file with the weights replaced by random numbers. 给他们一个mlmodel文件的版本,权重由随机数代替。 The model will still work but give nonsense predictions. 该模型将仍然有效,但会给出废话的预测。 Once that developer is done with their work, replace the model with the real one. 一旦开发人员完成工作,就用真正的模型替换模型。 Obviously, this is not a good solution if they need to use the model for whatever work they need to do. 显然,如果他们需要将模型用于需要做的任何工作,那么这不是一个好的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM