add image segmentation

修改ms模型

fix download ms file

fix segmentation stractrute
pull/9588/head
hukang hwx963878 4 years ago
parent 95573571f0
commit 40dc0b32fc

@ -8,16 +8,15 @@ android {
applicationId "com.mindspore.himindspore"
minSdkVersion 21
targetSdkVersion 30
versionCode 3
versionName "1.1.1"
versionCode 4
versionName "1.1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [moduleName: project.getName()]
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
buildTypes {
@ -69,10 +68,11 @@ dependencies {
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.alibaba:arouter-api:1.2.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.1.2'
implementation 'com.alibaba:arouter-api:1.5.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
implementation project(':posenet')
implementation project(':imageObject')
implementation project(':styletransfer')
implementation project(':segmentation')
}

@ -1,26 +0,0 @@
package com.mindspore.himindspore;
import android.content.Context;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.mindspore.himindspore", appContext.getPackageName());
}
}

@ -206,6 +206,14 @@ public class SplashActivity extends BaseActivity<MainPresenter> implements MainC
}
}
public void onClickSegmentation(View view) {
if (isAllGranted) {
ARouter.getInstance().build("/segmentation/SegmentationMainActivity").navigation(this);
} else {
requestPermissions();
}
}
public void onClickSouceCode(View view) {
openBrowser(CODE_URL);
}
@ -343,4 +351,5 @@ public class SplashActivity extends BaseActivity<MainPresenter> implements MainC
}
}

@ -14,7 +14,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="68dp"
android:drawableTop="@drawable/logo"
android:drawablePadding="30dp"
android:drawablePadding="20dp"
android:gravity="center_horizontal"
android:maxLines="1"
android:text="@string/app_name"
@ -133,11 +133,28 @@
app:layout_constraintEnd_toEndOf="@+id/btn_image_garbage"
app:layout_constraintWidth_percent="0.43" />
<Button
android:layout_marginTop="16dp"
android:id="@+id/btn_segmentation"
android:layout_width="0dp"
android:layout_height="48dp"
android:background="@color/gray_btn"
android:drawableStart="@drawable/btn_image"
android:drawablePadding="5dp"
android:gravity="left|center_vertical"
android:onClick="onClickSegmentation"
android:paddingLeft="4dp"
android:text="@string/title_segmentation"
android:textAllCaps="false"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="@+id/btn_posenet"
app:layout_constraintTop_toBottomOf="@+id/btn_posenet"
app:layout_constraintWidth_percent="0.43" />
<Button
android:id="@+id/btn_source"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:background="@color/gray_btn"
android:drawableStart="@drawable/btn_code"
android:drawablePadding="5dp"
@ -147,14 +164,15 @@
android:text="@string/title_source"
android:textAllCaps="false"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="@+id/btn_posenet"
app:layout_constraintTop_toBottomOf="@+id/btn_posenet"
app:layout_constraintBottom_toBottomOf="@+id/btn_segmentation"
app:layout_constraintEnd_toEndOf="@+id/btn_image_garbage"
app:layout_constraintWidth_percent="0.43" />
<Button
android:id="@+id/btn_help"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:background="@color/gray_btn"
android:drawableStart="@drawable/btn_help"
android:drawablePadding="5dp"
@ -164,8 +182,8 @@
android:text="@string/title_help"
android:textAllCaps="false"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/btn_source"
app:layout_constraintEnd_toEndOf="@+id/btn_image_garbage"
app:layout_constraintStart_toStartOf="@+id/btn_segmentation"
app:layout_constraintTop_toBottomOf="@+id/btn_segmentation"
app:layout_constraintWidth_percent="0.43" />
<TextView

@ -11,6 +11,7 @@
<string name="title_style_transfer">Style Transfer</string>
<string name="title_source">Source Code</string>
<string name="title_help">Help And FeedBack</string>
<string name="title_segmentation">Image Segmentation</string>
<string name="title_photo">Photo</string>
<string name="title_camera">Camera</string>

@ -16,7 +16,7 @@ android {
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [moduleName: project.getName()]
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
externalNativeBuild {
@ -77,6 +77,6 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.alibaba:arouter-api:1.2.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.1.2'
implementation 'com.alibaba:arouter-api:1.5.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
}

@ -13,7 +13,7 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [moduleName: project.getName()]
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
@ -59,13 +59,13 @@ apply from: 'download.gradle'
dependencies {
implementation project(':mindsporelibrary')
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.alibaba:arouter-api:1.2.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.1.2'
implementation 'com.alibaba:arouter-api:1.5.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
}

@ -69,4 +69,4 @@ class DownloadUrlTask extends DefaultTask {
void download() {
ant.get(src: sourceUrl, dest: target)
}
}
}

@ -0,0 +1,75 @@
plugins {
id 'com.android.library'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
aaptOptions {
noCompress "ms"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
flatDir {
dirs 'libs', '../mindsporelibrary/libs'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
apply from: 'download.gradle'
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.alibaba:arouter-api:1.5.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
implementation project(':mindsporelibrary')
}

@ -0,0 +1,34 @@
/**
* To download necessary library from HuaWei server.
* Including mindspore-lite .so file, minddata-lite .so file and model file.
* The libraries can be downloaded manually.
*/
def targetModelFile = "src/main/assets/segment_model.ms"
def modelDownloadUrl = "https://download.mindspore.cn/model_zoo/official/lite/mobile_segment_lite/segment_model.ms"
task downloadModelFile(type: DownloadUrlTask) {
doFirst {
println "Downloading ${modelDownloadUrl}"
}
sourceUrl = "${modelDownloadUrl}"
target = file("${targetModelFile}")
}
if (file("src/main/assets/segment_model.ms").exists()) {
downloadModelFile.enabled = false
}
preBuild.dependsOn downloadModelFile
class DownloadUrlTask extends DefaultTask {
@Input
String sourceUrl
@OutputFile
File target
@TaskAction
void download() {
ant.get(src: sourceUrl, dest: target)
}
}

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mindspore.imagesegmentation">
<application
tools:replace="android:label"
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">
<activity android:name=".SegmentationMainActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar">
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.mindspore.imagesegmentation.fileprovider"
android:exported="false"
tools:replace="android:authorities"
android:grantUriPermissions="true">
<meta-data
tools:replace="android:resource"
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"/>
</provider>
</application>
</manifest>

@ -0,0 +1,25 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mindspore.imagesegmentation;
import android.view.View;
public interface OnBackgroundImageListener {
void onBackImageSelected(int position);
void onImageAdd(View view);
}

@ -0,0 +1,97 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mindspore.imagesegmentation;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
public class StyleRecyclerViewAdapter extends RecyclerView.Adapter<StyleRecyclerViewAdapter.StyleItemViewHolder> {
private final int[] IMAGES;
private final Context context;
private final OnBackgroundImageListener mListener;
public StyleRecyclerViewAdapter(Context context, int[] IMAGES, OnBackgroundImageListener mListener) {
this.IMAGES = IMAGES;
this.context = context;
this.mListener = mListener;
}
@NonNull
@Override
public StyleItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context)
.inflate(R.layout.image_item, parent, false);
return new StyleItemViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull StyleItemViewHolder holder, int position) {
Glide.with(context).
load(IMAGES[position]).
into(holder.getImageView());
View view = holder.getMView();
view.setTag(IMAGES[position]);
view.setOnClickListener(view1 -> {
if (mListener != null) {
if (IMAGES.length - 1 == position) {
mListener.onImageAdd(holder.getImageView());
} else {
mListener.onBackImageSelected(position);
}
}
});
}
@Override
public int getItemCount() {
return IMAGES == null ? 0 : IMAGES.length;
}
public class StyleItemViewHolder extends RecyclerView.ViewHolder {
private ImageView imageView;
private final View mView;
public final ImageView getImageView() {
return this.imageView;
}
public final void setImageView(ImageView imageView) {
this.imageView = imageView;
}
public final View getMView() {
return this.mView;
}
public StyleItemViewHolder(View mView) {
super(mView);
this.mView = mView;
this.imageView = mView.findViewById(R.id.image_view);
}
}
}

@ -0,0 +1,81 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mindspore.imagesegmentation.help;
import android.graphics.Bitmap;
import java.util.Set;
public class ModelTrackingResult {
private Bitmap bitmapResult;
private Bitmap bitmapOriginal;
private Bitmap bitmapMaskOnly;
private String executionLog;
private Set<Integer> itemsFound;
public ModelTrackingResult(Bitmap bitmapResult, Bitmap bitmapOriginal, Bitmap bitmapMaskOnly, String executionLog, Set<Integer> itemsFound) {
this.bitmapResult = bitmapResult;
this.bitmapOriginal = bitmapOriginal;
this.bitmapMaskOnly = bitmapMaskOnly;
this.executionLog = executionLog;
this.itemsFound = itemsFound;
}
public Bitmap getBitmapResult() {
return bitmapResult;
}
public ModelTrackingResult setBitmapResult(Bitmap bitmapResult) {
this.bitmapResult = bitmapResult;
return this;
}
public Bitmap getBitmapOriginal() {
return bitmapOriginal;
}
public ModelTrackingResult setBitmapOriginal(Bitmap bitmapOriginal) {
this.bitmapOriginal = bitmapOriginal;
return this;
}
public Bitmap getBitmapMaskOnly() {
return bitmapMaskOnly;
}
public ModelTrackingResult setBitmapMaskOnly(Bitmap bitmapMaskOnly) {
this.bitmapMaskOnly = bitmapMaskOnly;
return this;
}
public String getExecutionLog() {
return executionLog;
}
public ModelTrackingResult setExecutionLog(String executionLog) {
this.executionLog = executionLog;
return this;
}
public Set<Integer> getItemsFound() {
return itemsFound;
}
public ModelTrackingResult setItemsFound(Set<Integer> itemsFound) {
this.itemsFound = itemsFound;
return this;
}
}

@ -0,0 +1,218 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mindspore.imagesegmentation.help;
import android.content.Context;
import android.graphics.Bitmap;
import android.util.Log;
import androidx.core.graphics.ColorUtils;
import com.mindspore.lite.LiteSession;
import com.mindspore.lite.MSTensor;
import com.mindspore.lite.Model;
import com.mindspore.lite.config.CpuBindMode;
import com.mindspore.lite.config.DeviceType;
import com.mindspore.lite.config.MSConfig;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
public class TrackingMobile {
private static final String TAG = "TrackingMobile";
private static final String IMAGESEGMENTATIONMODEL = "segment_model.ms";
private static final int imageSize = 257;
public static final int NUM_CLASSES = 21;
private static final float IMAGE_MEAN = 127.5F;
private static final float IMAGE_STD = 127.5F;
public static final int[] segmentColors = new int[2];
private Bitmap maskBitmap;
private Bitmap resultBitmap;
private HashSet itemsFound = new HashSet();
private final Context mContext;
private MSConfig msConfig;
private LiteSession session;
private Model model;
public TrackingMobile(Context context) {
mContext = context;
init();
}
public void init() {
// Load the .ms model.
model = new Model();
if (!model.loadModel(mContext, IMAGESEGMENTATIONMODEL)) {
Log.e(TAG, "Load Model failed");
return;
}
// Create and init config.
msConfig = new MSConfig();
if (!msConfig.init(DeviceType.DT_CPU, 2, CpuBindMode.MID_CPU)) {
Log.e(TAG, "Init context failed");
return;
}
// Create the MindSpore lite session.
session = new LiteSession();
if (!session.init(msConfig)) {
Log.e(TAG, "Create session failed");
msConfig.free();
return;
}
msConfig.free();
// Complile graph.
if (!session.compileGraph(model)) {
Log.e(TAG, "Compile graph failed");
model.freeBuffer();
return;
}
// Note: when use model.freeBuffer(), the model can not be complile graph again.
model.freeBuffer();
}
public ModelTrackingResult execut(Bitmap bitmap) {
// Set input tensor values.
List<MSTensor> inputs = session.getInputs();
if (inputs.size() != 1) {
Log.e(TAG, "inputs.size() != 1");
return null;
}
float resource_height = bitmap.getHeight();
float resource_weight = bitmap.getWidth();
Bitmap scaledBitmap = BitmapUtils.scaleBitmapAndKeepRatio(bitmap, imageSize, imageSize);
ByteBuffer contentArray = BitmapUtils.bitmapToByteBuffer(scaledBitmap, imageSize, imageSize, IMAGE_MEAN, IMAGE_STD);
MSTensor inTensor = inputs.get(0);
// int byteLen = (int) inTensor.size();
inTensor.setData(contentArray);
// Run graph to infer results.
if (!session.runGraph()) {
Log.e(TAG, "Run graph failed");
return null;
}
// Get output tensor values.
List<String> tensorNames = session.getOutputTensorNames();
Map<String, MSTensor> outputs = session.getOutputMapByTensor();
for (String tensorName : tensorNames) {
MSTensor output = outputs.get(tensorName);
if (output == null) {
Log.e(TAG, "Can not find output " + tensorName);
return null;
}
float[] results = output.getFloatData();
float[] result = new float[output.elementsNum()];
int batch = output.getShape()[0];
int channel = output.getShape()[1];
int weight = output.getShape()[2];
int hight = output.getShape()[3];
int plane = weight * hight;
for (int n = 0; n < batch; n++) {
for (int c = 0; c < channel; c++) {
for (int hw = 0; hw < plane; hw++) {
result[n * channel * plane + hw * channel + c] = results[n * channel * plane + c * plane + hw];
}
}
}
ByteBuffer bytebuffer_results = floatArrayToByteArray(result);
convertBytebufferMaskToBitmap(
bytebuffer_results, imageSize, imageSize, scaledBitmap,
segmentColors
);
//scaledBitmap resize成resource_heightresource_weight
scaledBitmap = BitmapUtils.scaleBitmapAndKeepRatio(scaledBitmap, (int) resource_height, (int) resource_weight);
resultBitmap = BitmapUtils.scaleBitmapAndKeepRatio(resultBitmap, (int) resource_height, (int) resource_weight);
maskBitmap = BitmapUtils.scaleBitmapAndKeepRatio(maskBitmap, (int) resource_height, (int) resource_weight);
}
return new ModelTrackingResult(resultBitmap, scaledBitmap, maskBitmap, this.formatExecutionLog(), itemsFound);
}
private static ByteBuffer floatArrayToByteArray(float[] floats) {
ByteBuffer buffer = ByteBuffer.allocate(4 * floats.length);
FloatBuffer floatBuffer = buffer.asFloatBuffer();
floatBuffer.put(floats);
return buffer;
}
private void convertBytebufferMaskToBitmap(ByteBuffer inputBuffer, int imageWidth,
int imageHeight, Bitmap backgroundImage, int[] colors) {
Bitmap.Config conf = Bitmap.Config.ARGB_8888;
maskBitmap = Bitmap.createBitmap(imageWidth, imageHeight, conf);
resultBitmap = Bitmap.createBitmap(imageWidth, imageHeight, conf);
Bitmap scaledBackgroundImage =
BitmapUtils.scaleBitmapAndKeepRatio(backgroundImage, imageWidth, imageHeight);
int[][] mSegmentBits = new int[imageWidth][imageHeight];
inputBuffer.rewind();
for (int y = 0; y < imageHeight; y++) {
for (int x = 0; x < imageWidth; x++) {
float maxVal = 0f;
mSegmentBits[x][y] = 0;
for (int i = 0; i < NUM_CLASSES; i++) {
float value = inputBuffer.getFloat((y * imageWidth * NUM_CLASSES + x * NUM_CLASSES + i) * 4);
if (i == 0 || value > maxVal) {
maxVal = value;
if (i == 15) {
mSegmentBits[x][y] = i;
} else {
mSegmentBits[x][y] = 0;
}
}
}
itemsFound.add(mSegmentBits[x][y]);
int newPixelColor = ColorUtils.compositeColors(
colors[mSegmentBits[x][y] == 0 ? 0 : 1],
scaledBackgroundImage.getPixel(x, y)
);
resultBitmap.setPixel(x, y, newPixelColor);
maskBitmap.setPixel(x, y, mSegmentBits[x][y] == 0 ? colors[0] : scaledBackgroundImage.getPixel(x, y));
}
}
}
// Note: we must release the memory at the end, otherwise it will cause the memory leak.
public void free() {
session.free();
model.free();
}
private final String formatExecutionLog() {
StringBuilder sb = new StringBuilder();
sb.append("Input Image Size: " + imageSize * imageSize + '\n');
return sb.toString();
}
}

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save