Designing and Implementing a Microsoft Azure AI Solution

Exporting Custom Vision Classifier to ONNX10

Question

You plan to export your custom vision classifier in Azure and use it in your application to run locally on the mobile devices for real time classification.

You use compact domains for this export.

Assuming that you are using platform ONNX to export to and format as ONNX10, review the code below and complete it by choosing the most appropriate answer choice.

project_id = "<Project Id>" iteration_id = "Iteration Id" platform = "ONNX" flavor = "ONNX10" export = trainer.……………………………...(project_id, iteration_id, platform, flavor, raw=False.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: B.

Option A is incorrect because export_project exports a project.

However the requirement is to export a model iteration.

Option B is correct because export_iteration is used for exporting a trained model iteration.

Here is the completed code:

project_id = "&amp;lt;Project Id&amp;gt;"

iteration_id = "Iteration Id"

platform = "ONNX"

flavor = "ONNX10"

export = trainer.export_iteration(project_id, iteration_id, platform, flavor, raw=False) Option C is incorrect because update_project is used to update an existing project.

Option D is incorrect because update_iteration is used to update an existing iteration.

However, the requirement is to export it.

Reference:

To learn more about exporting a model in a custom vision service to use it on mobile devices, use the link given below:

To export a custom vision classifier in Azure, the code should use the method export_iteration of the trainer object. The method takes five parameters: project_id, iteration_id, platform, flavor, and raw.

The project_id parameter is a string that specifies the ID of the project that contains the iteration to be exported. The iteration_id parameter is also a string that specifies the ID of the iteration to be exported.

The platform parameter specifies the platform to which the model should be exported, in this case, ONNX. The flavor parameter specifies the version of the ONNX format to use, which is ONNX10 in this case.

The raw parameter is a Boolean value that specifies whether to return the exported model as raw bytes or as a stream. The default value is False, which means that the method returns the exported model as a stream.

Therefore, the correct answer is B. export_iteration. The correct code to export the custom vision classifier to ONNX10 format is:

makefile
project_id = "<Project Id>" iteration_id = "Iteration Id" platform = "ONNX" flavor = "ONNX10" export = trainer.export_iteration(project_id, iteration_id, platform, flavor, raw=False)

Note that you should replace <Project Id> with the actual ID of your project, and "Iteration Id" with the actual ID of the iteration to be exported.