我已经制作了一个自定义模块,并使用“ api”配置在其中包含了tensorflow-lite依赖项。我建立它的aar。现在,我创建一个新项目并将aar放在libs文件夹中。但是我只能访问我创建的类,而不能访问tensorflow api。如何在不再次包含传递依赖项的情况下使用传递依赖项?
我在博客(https://medium.com/mindorks/implementation-vs-api-in-gradle-3-0-494c817a6fa)中将其替换为“ api” 。
build.gradle(模块:mylib)
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
aaptOptions{
noCompress "tflite"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'androidx.appcompat:appcompat:1.1.0-alpha04'
api 'org.tensorflow:tensorflow-lite:0.0.0-gpu-experimental'
}
Run Code Online (Sandbox Code Playgroud)
build.gradle(模块:新项目中的两个):
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner …Run Code Online (Sandbox Code Playgroud) android android-library android-gradle-plugin android-module
我从这里使用 tflite 模型进行posenet 。它接受输入 1*353*257*3 输入图像并返回 4 个维度数组 1*23*17*17、1*23*17*34、1*23*17*64 和 1*23*17*1。该模型的输出步长为 16。如何获取输入图像上所有 17 个姿势点的坐标?我尝试从 out1 数组的热图中打印置信度分数,但每个像素的值接近 0.00。代码如下:
public class MainActivity extends AppCompatActivity {
private static final int CAMERA_REQUEST = 1888;
private ImageView imageView;
private static final int MY_CAMERA_PERMISSION_CODE = 100;
Interpreter tflite = null;
private String TAG = "rohit";
//private Canvas canvas;
Map<Integer, Object> outputMap = new HashMap<>();
float[][][][] out1 = new float[1][23][17][17];
float[][][][] out2 = new float[1][23][17][34];
float[][][][] out3 = new float[1][23][17][64];
float[][][][] out4 = new float[1][23][17][1]; …Run Code Online (Sandbox Code Playgroud) android computer-vision pose-estimation tensorflow tensorflow-lite