From 40dc0b32fc3b01196917e215f283573baddea8ab Mon Sep 17 00:00:00 2001 From: hukang hwx963878 Date: Fri, 4 Dec 2020 14:54:01 +0800 Subject: [PATCH] add image segmentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改ms模型 fix download ms file fix segmentation stractrute --- .../lite/Himindspore/app/build.gradle | 12 +- .../himindspore/ExampleInstrumentedTest.java | 26 -- .../mindspore/himindspore/SplashActivity.java | 9 + .../src/main/res/layout/activity_splash.xml | 30 +- .../app/src/main/res/values/strings.xml | 1 + .../lite/Himindspore/imageObject/build.gradle | 6 +- .../lite/Himindspore/posenet/build.gradle | 8 +- .../lite/Himindspore/posenet/download.gradle | 2 +- .../.gitignore | 0 .../Himindspore/segmentation/build.gradle | 75 +++++ .../Himindspore/segmentation/download.gradle | 34 ++ .../segmentation/proguard-rules.pro | 21 ++ .../segmentation/src/main/AndroidManifest.xml | 30 ++ .../OnBackgroundImageListener.java | 25 ++ .../SegmentationMainActivity.java | 1 + .../StyleRecyclerViewAdapter.java | 97 ++++++ .../imagesegmentation/help/BitmapUtils.java} | 232 ++++++++------ .../help/ModelTrackingResult.java | 81 +++++ .../help/TrackingMobile.java | 218 +++++++++++++ .../drawable-v24/ic_launcher_foreground.xml | 30 ++ .../src/main/res/drawable-xxhdpi/add.jpg | Bin 0 -> 19013 bytes .../src/main/res/drawable-xxhdpi/img_001.jpg | Bin 0 -> 4119 bytes .../src/main/res/drawable-xxhdpi/img_002.jpg | Bin 0 -> 4123 bytes .../src/main/res/drawable-xxhdpi/img_003.jpg | Bin 0 -> 4122 bytes .../src/main/res/drawable-xxhdpi/img_004.jpg | Bin 0 -> 107158 bytes .../src/main/res/drawable-xxhdpi/img_005.jpg | Bin 0 -> 29522 bytes .../src/main/res/drawable-xxhdpi/img_006.jpg | Bin 0 -> 33363 bytes .../src/main/res/drawable-xxhdpi/img_007.jpg | Bin 0 -> 28811 bytes .../src/main/res/drawable-xxhdpi/img_008.jpg | Bin 0 -> 38988 bytes .../src/main/res/drawable-xxhdpi/img_009.jpg | Bin 0 -> 23243 bytes .../src/main/res/drawable-xxhdpi/logo2.png | Bin 0 -> 9405 bytes .../res/drawable/ic_launcher_background.xml | 170 ++++++++++ .../src/main/res/drawable/progressbar.xml | 20 ++ .../src/main/res/layout/activity_main.xml | 141 +++++++++ .../src/main/res/layout/image_item.xml | 14 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3593 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5339 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2636 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 3388 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4926 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7472 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7909 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 11873 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10652 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 16570 bytes .../src/main/res/values/colors.xml | 21 ++ .../src/main/res/values/strings.xml | 5 + .../src/main/res/values/themes.xml | 5 + .../src/main/res/xml/file_paths.xml | 6 + .../official/lite/Himindspore/settings.gradle | 1 + .../Himindspore/styletransfer/build.gradle | 8 +- .../image_segmentation/app/download.gradle | 6 +- .../imagesegmentation/BitmapUtils.java | 151 --------- .../imagesegmentation/MainActivity.java | 4 +- .../imagesegmentation/help/BitmapUtils.java | 299 ++++++++++++++++++ .../help/TrackingMobile.java | 30 +- .../lite/image_segmentation/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 4 +- 58 files changed, 1509 insertions(+), 316 deletions(-) delete mode 100644 model_zoo/official/lite/Himindspore/app/src/androidTest/java/com/mindspore/himindspore/ExampleInstrumentedTest.java rename model_zoo/official/lite/Himindspore/{mindsporelibrary => segmentation}/.gitignore (100%) create mode 100644 model_zoo/official/lite/Himindspore/segmentation/build.gradle create mode 100644 model_zoo/official/lite/Himindspore/segmentation/download.gradle create mode 100644 model_zoo/official/lite/Himindspore/segmentation/proguard-rules.pro create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/AndroidManifest.xml create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/java/com/mindspore/imagesegmentation/OnBackgroundImageListener.java create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/java/com/mindspore/imagesegmentation/SegmentationMainActivity.java create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/java/com/mindspore/imagesegmentation/StyleRecyclerViewAdapter.java rename model_zoo/official/lite/{image_segmentation/app/src/main/java/com/mindspore/imagesegmentation/help/ImageUtils.java => Himindspore/segmentation/src/main/java/com/mindspore/imagesegmentation/help/BitmapUtils.java} (53%) create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/java/com/mindspore/imagesegmentation/help/ModelTrackingResult.java create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/java/com/mindspore/imagesegmentation/help/TrackingMobile.java create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/add.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/img_001.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/img_002.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/img_003.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/img_004.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/img_005.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/img_006.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/img_007.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/img_008.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/img_009.jpg create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable-xxhdpi/logo2.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable/ic_launcher_background.xml create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/drawable/progressbar.xml create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/layout/activity_main.xml create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/layout/image_item.xml create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/values/colors.xml create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/values/strings.xml create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/values/themes.xml create mode 100644 model_zoo/official/lite/Himindspore/segmentation/src/main/res/xml/file_paths.xml delete mode 100644 model_zoo/official/lite/image_segmentation/app/src/main/java/com/mindspore/imagesegmentation/BitmapUtils.java create mode 100644 model_zoo/official/lite/image_segmentation/app/src/main/java/com/mindspore/imagesegmentation/help/BitmapUtils.java diff --git a/model_zoo/official/lite/Himindspore/app/build.gradle b/model_zoo/official/lite/Himindspore/app/build.gradle index 0d86b0e8288..6ff55793c12 100644 --- a/model_zoo/official/lite/Himindspore/app/build.gradle +++ b/model_zoo/official/lite/Himindspore/app/build.gradle @@ -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') } diff --git a/model_zoo/official/lite/Himindspore/app/src/androidTest/java/com/mindspore/himindspore/ExampleInstrumentedTest.java b/model_zoo/official/lite/Himindspore/app/src/androidTest/java/com/mindspore/himindspore/ExampleInstrumentedTest.java deleted file mode 100644 index 840c4d2eb47..00000000000 --- a/model_zoo/official/lite/Himindspore/app/src/androidTest/java/com/mindspore/himindspore/ExampleInstrumentedTest.java +++ /dev/null @@ -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 Testing documentation - */ -@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()); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/Himindspore/app/src/main/java/com/mindspore/himindspore/SplashActivity.java b/model_zoo/official/lite/Himindspore/app/src/main/java/com/mindspore/himindspore/SplashActivity.java index eb5fce60e8f..a6669d60aab 100644 --- a/model_zoo/official/lite/Himindspore/app/src/main/java/com/mindspore/himindspore/SplashActivity.java +++ b/model_zoo/official/lite/Himindspore/app/src/main/java/com/mindspore/himindspore/SplashActivity.java @@ -206,6 +206,14 @@ public class SplashActivity extends BaseActivity 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 implements MainC } + } \ No newline at end of file diff --git a/model_zoo/official/lite/Himindspore/app/src/main/res/layout/activity_splash.xml b/model_zoo/official/lite/Himindspore/app/src/main/res/layout/activity_splash.xml index 20eda835472..764d97d1d6f 100644 --- a/model_zoo/official/lite/Himindspore/app/src/main/res/layout/activity_splash.xml +++ b/model_zoo/official/lite/Himindspore/app/src/main/res/layout/activity_splash.xml @@ -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" /> +