使用 ONNX 在 Azure SQL Edge 上部署 ML 模型

重要

截至 2025 年 9 月 30 日,Azure SQL Edge 已停用。 有关详细信息和迁移选项,请参阅停用通知

注释

Azure SQL Edge 不再支持 ARM64 平台。

本 Azure SQL Edge 铁矿石杂质预测教程由三部分组成,在第三部分中,你将:

  1. 使用 Azure Data Studio 连接到 Azure SQL Edge 实例中的 SQL 数据库。
  2. 在 Azure SQL Edge 中通过 ONNX 预测铁矿石杂质。

关键组件

  1. 此解决方案在发送到 Edge 中心的每条消息之间使用默认的 500 毫秒。 可以在 Program.cs 文件中更改此值

    TimeSpan messageDelay = configuration.GetValue("MessageDelay", TimeSpan.FromMilliseconds(500));
    
  2. 解决方案生成了具有以下属性的消息。 根据需要添加或删除属性。

    {
        timestamp
        cur_Iron_Feed
        cur_Silica_Feed
        cur_Starch_Flow
        cur_Amina_Flow
        cur_Ore_Pulp_pH
        cur_Flotation_Column_01_Air_Flow
        cur_Flotation_Column_02_Air_Flow
        cur_Flotation_Column_03_Air_Flow
        cur_Flotation_Column_04_Air_Flow
        cur_Flotation_Column_01_Level
        cur_Flotation_Column_02_Level
        cur_Flotation_Column_03_Level
        cur_Flotation_Column_04_Level
        cur_Iron_Concentrate
    }
    

连接到 Azure SQL Edge 实例中的 SQL 数据库,以训练、部署和测试 ML 模型

  1. 打开 Azure Data Studio。

  2. 在“欢迎使用”选项卡中,使用以下详细信息启动一个新连接:

    领域 价值
    连接类型 Microsoft SQL Server
    Server 为此演示创建的 VM 中提及的公共 IP 地址
    用户名 sa
    密码 创建 Azure SQL Edge 实例时使用的强密码
    数据库 违约
    服务器组 违约
    名称(可选) 提供可选名称
  3. 选择 连接

  4. 在“文件”部分,从你将项目文件克隆到的计算机上的文件夹中打开

  5. 将内核设置为 Python 3。