添加骨骼和风格迁移代码格式化

himindspore添加骨骼和风格迁移模块

himindspore添加骨骼和风格迁移模块

himindspore添加骨骼和风格迁移模块

去除注释
pull/8986/head
hukang hwx963878 5 years ago
parent 85e4efd706
commit 21075e30da

@ -8,22 +8,16 @@ android {
applicationId "com.mindspore.himindspore"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared"
cppFlags "-std=c++17"
javaCompileOptions {
annotationProcessorOptions {
arguments = [moduleName: project.getName()]
}
}
ndk {
abiFilters 'arm64-v8a'
}
}
aaptOptions {
noCompress '.so', 'ms'
}
buildTypes {
@ -32,48 +26,28 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
customDebugType {
debuggable true
}
}
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
}
}
ndkVersion '21.3.6528147'
sourceSets{
main {
jniLibs.srcDirs = ['libs']
}
}
packagingOptions{
pickFirst 'lib/arm64-v8a/libmlkit-label-MS.so'
aaptOptions {
noCompress "ms"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
// Before gradle build.
// To download some necessary libraries.
apply from:'download.gradle'
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.cardview:cardview:1.0.0'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.sun.mail:android-mail:1.6.5'
implementation 'com.sun.mail:android-activation:1.6.5'
implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.2'
implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.2'
@ -85,4 +59,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 project(':posenet')
implementation project(':imageObject')
implementation project(':styletransfer')
}

@ -2,13 +2,13 @@ package com.mindspore.himindspore;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
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.*;
import static org.junit.Assert.assertEquals;
/**
* Instrumented test, which will execute on an Android device.

@ -14,6 +14,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".base.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@ -35,30 +36,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".imageclassification.ui.ImageMainActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".contract.ContractActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".objectdetection.ui.ObjectDetectionMainActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".objectdetection.ui.ObjectCameraActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".objectdetection.ui.ObjectPhotoActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".imageclassification.ui.ImageCameraActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<provider
android:name="androidx.core.content.FileProvider"

@ -1,3 +1,18 @@
/**
* 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.himindspore;
import android.Manifest;
@ -11,7 +26,7 @@ import android.os.Build;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
@ -19,25 +34,27 @@ import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.core.content.FileProvider;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mindspore.himindspore.base.BaseActivity;
import com.mindspore.himindspore.imageclassification.ui.ImageMainActivity;
import com.mindspore.himindspore.mvp.MainContract;
import com.mindspore.himindspore.mvp.MainPresenter;
import com.mindspore.himindspore.net.FileDownLoadObserver;
import com.mindspore.himindspore.net.UpdateInfoBean;
import com.mindspore.himindspore.objectdetection.ui.ObjectDetectionMainActivity;
import java.io.File;
public class SplashActivity extends BaseActivity<MainPresenter> implements MainContract.View, View.OnClickListener {
@Route(path = "/himindspore/SplashActivity")
public class SplashActivity extends BaseActivity<MainPresenter> implements MainContract.View {
private static final String TAG = "SplashActivity";
private static final int REQUEST_PERMISSION = 1;
private Button btnImage, btnObject, btnContract, btnAdvice;
private boolean isHasPermssion;
private int now_version;
private ProgressDialog progressDialog;
private TextView versionText;
private static final String CODE_URL = "https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/lite";
private static final String HELP_URL = "https://github.com/mindspore-ai/mindspore/issues";
@ -46,17 +63,8 @@ public class SplashActivity extends BaseActivity<MainPresenter> implements MainC
@Override
protected void init() {
presenter = new MainPresenter(this);
btnImage = findViewById(R.id.btn_image);
btnObject = findViewById(R.id.btn_object);
btnContract = findViewById(R.id.btn_contact);
btnAdvice = findViewById(R.id.btn_advice);
btnImage.setOnClickListener(this);
btnObject.setOnClickListener(this);
btnContract.setOnClickListener(this);
btnAdvice.setOnClickListener(this);
versionText = findViewById(R.id.tv_vision);
showPackaeInfo();
requestPermissions();
getUpdateInfo();
}
@ -66,6 +74,18 @@ public class SplashActivity extends BaseActivity<MainPresenter> implements MainC
return R.layout.activity_splash;
}
private void showPackaeInfo() {
try {
PackageManager packageManager = this.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(this.getPackageName(), 0);
now_version = packageInfo.versionCode;
versionText.setText("Version: " + packageInfo.versionName);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
private void requestPermissions() {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE,
@ -87,27 +107,65 @@ public class SplashActivity extends BaseActivity<MainPresenter> implements MainC
}
@Override
public void onClick(View view) {
if (R.id.btn_image == view.getId()) {
public void onClickImage(View view) {
if (isHasPermssion) {
startActivity(new Intent(SplashActivity.this, ImageMainActivity.class));
ARouter.getInstance().build("/imageobject/ImageCameraActivity")
.withInt("OPEN_TYPE", 1).navigation();
} else {
requestPermissions();
}
} else if (R.id.btn_object == view.getId()) {
}
public void onClickGarbage(View view) {
if (isHasPermssion) {
startActivity(new Intent(SplashActivity.this, ObjectDetectionMainActivity.class));
ARouter.getInstance().build("/imageobject/ImageCameraActivity")
.withInt("OPEN_TYPE", 2).navigation();
} else {
requestPermissions();
}
} else if (R.id.btn_contact == view.getId()) {
}
public void onClickPhotoDetection(View view) {
if (isHasPermssion) {
ARouter.getInstance().build("/imageobject/ObjectPhotoActivity").navigation();
} else {
requestPermissions();
}
}
public void onClickCameraDetection(View view) {
if (isHasPermssion) {
ARouter.getInstance().build("/imageobject/ObjectCameraActivity").navigation();
} else {
requestPermissions();
}
}
public void onClickPoseNet(View view) {
if (isHasPermssion) {
ARouter.getInstance().build("/posenet/PosenetMainActivity").navigation(this);
} else {
requestPermissions();
}
}
public void onClickStyleTransfer(View view) {
if (isHasPermssion) {
ARouter.getInstance().build("/styletransfer/StyleMainActivity").navigation(this);
} else {
requestPermissions();
}
}
public void onClickSouceCode(View view) {
openBrowser(CODE_URL);
} else if (R.id.btn_advice == view.getId()) {
openBrowser(HELP_URL);
}
public void onClickHelp(View view) {
openBrowser(HELP_URL);
}
public void openBrowser(String url) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
@ -160,16 +218,7 @@ public class SplashActivity extends BaseActivity<MainPresenter> implements MainC
}
private int now_version;
public void showUpdate(final UpdateInfoBean updateInfo) {
try {
PackageManager packageManager = this.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(this.getPackageName(), 0);
now_version = packageInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (now_version == updateInfo.getVersionCode()) {
Toast.makeText(this, "已经是最新版本", Toast.LENGTH_SHORT).show();
@ -245,4 +294,5 @@ public class SplashActivity extends BaseActivity<MainPresenter> implements MainC
return directoryPath;
}
}

@ -1,3 +1,18 @@
/**
* 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.himindspore.base;
import android.app.Activity;

@ -1,3 +1,18 @@
/**
* 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.himindspore.base;
public abstract class BasePresenter<T extends BaseActivity> {

@ -0,0 +1,34 @@
/**
* 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.himindspore.base;
import android.app.Application;
import com.alibaba.android.arouter.BuildConfig;
import com.alibaba.android.arouter.launcher.ARouter;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
ARouter.openLog();
ARouter.openDebug();
}
ARouter.init(this);
}
}

@ -1,4 +0,0 @@
package com.mindspore.himindspore.base;
public interface TrackListener {
}

@ -1,37 +0,0 @@
package com.mindspore.himindspore.imageclassification.ui;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.mindspore.himindspore.R;
public class ImageMainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image_main);
findViewById(R.id.btn_demo).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(ImageMainActivity.this, ImageCameraActivity.class);
intent.putExtra(ImageCameraActivity.OPEN_TYPE, ImageCameraActivity.TYPE_DEMO);
startActivity(intent);
}
});
findViewById(R.id.btn_custom).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(ImageMainActivity.this, ImageCameraActivity.class);
intent.putExtra(ImageCameraActivity.OPEN_TYPE, ImageCameraActivity.TYPE_CUSTOM);
startActivity(intent);
}
});
}
}

@ -1,3 +1,18 @@
/**
* 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.himindspore.mvp;
import com.mindspore.himindspore.net.FileDownLoadObserver;

@ -1,4 +1,19 @@
package com.mindspore.himindspore.mvp;
/**
* 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.
*/
import android.util.Log;
@ -40,7 +55,7 @@ public class MainPresenter extends BasePresenter<SplashActivity> implements Main
@Override
public void onFailure(Call<UpdateInfoBean> call, Throwable t) {
Log.e(TAG, "onFailure" + t.toString());
Log.e(TAG, "onFailure>>>" + t.toString());
view.showFail(call.toString());
}
});

@ -1,71 +0,0 @@
package com.mindspore.himindspore.objectdetection.ui;
import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import com.mindspore.himindspore.R;
public class ObjectDetectionMainActivity extends AppCompatActivity implements View.OnClickListener {
private static final int REQUEST_CAMERA_PERMISSION = 2;
private static final int REQUEST_PHOTO_PERMISSION = 3;
private Button btnPhoto, btnCamera;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_object_detection_main);
btnPhoto = findViewById(R.id.btn_photo);
btnCamera = findViewById(R.id.btn_camera);
btnPhoto.setOnClickListener(this);
btnCamera.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (R.id.btn_photo == view.getId()) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_PHONE_STATE}, REQUEST_PHOTO_PERMISSION);
} else if (R.id.btn_camera == view.getId()) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_PHONE_STATE, Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);
}
}
/**
* Authority application result callback
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (REQUEST_PHOTO_PERMISSION == requestCode) {
choosePhoto();
} else if (REQUEST_CAMERA_PERMISSION == requestCode) {
chooseCamera();
}
}
private void choosePhoto() {
Intent intent = new Intent(ObjectDetectionMainActivity.this, ObjectPhotoActivity.class);
startActivity(intent);
}
private void chooseCamera() {
Intent intent = new Intent(ObjectDetectionMainActivity.this, ObjectCameraActivity.class);
startActivity(intent);
}
}

@ -1,4 +0,0 @@
package com.mindspore.himindspore.track;
public interface TrackListener {
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

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

Loading…
Cancel
Save