使用FireBase机器学习套件的新功能autoML搭建训练发布模型,并在Android上使用进行图片分类

// …

}

}

  1. 在Gradle 文件(通常是 app/build.gradle)中,在文件末尾添加一行内容。

apply plugin: ‘com.android.application’

android {

// …

}

// 添加以下内容:

apply plugin: ‘com.google.gms.google-services’ // Google Play services Gradle plugin

第四步:将 Firebase SDK 添加到APP

在(应用级)Gradle 文件(通常是 app/build.gradle)中,添加核心 Firebase SDK 的依赖项:

buildscript {

repositories {

// Check that you have the following line (if not, add it):

google() // Google’s Maven repository

}

dependencies {

// Add this line

classpath ‘com.google.gms:google-services:4.3.3’

}

}

allprojects {

repositories {

// Check that you have the following line (if not, add it):

google() // Google’s Maven repository

}

}

应用级 build.gradle(<项目>/<应用模块>/build.gradle):

apply plugin: ‘com.android.application’

// Add this line

apply plugin: ‘com.google.gms.google-services’

dependencies {

// add the Firebase SDK for Google Analytics

implementation ‘com.google.firebase:firebase-analytics:17.2.2’

// add SDKs for any other desired Firebase products

// https://firebase.google.com/docs/android/setup#available-libraries

}

最后,按 IDE 中显示的栏中的“立即同步”:

  1. 同步您的应用以确保所有依赖项都具有必要的版本。

  2. 运行应用,向 Firebase 发送已成功集成 Firebase 的验证信息。

设备日志将显示说明初始化已完成的 Firebase 验证信息。如果我们是在具有网络访问权限的模拟器上运行应用,则 Firebase 控制台会通知说应用连接已完成。

使用 “ML KIT” 的 autoML 搭建训练发布模型


第一步:下载数据集:

我这里使用的是使用 TensorFlow 的 flower-image 数据集,创建图像分类或标签模型,在训练了该模型后,将其用于应用程序中的设备上图像标签。

这个数据集又5种标签的雏菊,蒲公英,玫瑰,向日葵和郁金香花,这样后面的 app 就可以使用模型标识图像的标签之一。

下载花卉图像数据集。

第二步:上传和训练数据集:

转到 Firebase 控制台-> Machine Learning,然后单击 “AutoML” 。

现在,单击添加数据集

给数据集命名并选择第二个选项,然后单击继续。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值