mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
[Android] Add Super Resolution app module (#880)
* add Superscript. * change "superscript" to "super resolution". * delete camera page,add album select button. * VoiceAssistant and SuperResolution add SettingsActivity. * VoiceAssistant and SuperResolution add SettingsActivity. Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:drawable="@drawable/album" />
|
||||
<item android:state_focused="true" android:drawable="@drawable/album" />
|
||||
<item android:state_pressed="true" android:drawable="@drawable/album" />
|
||||
<item android:drawable="@drawable/album_pressed" />
|
||||
<item android:state_selected="true" android:drawable="@drawable/album_pressed" />
|
||||
<item android:state_focused="true" android:drawable="@drawable/album_pressed" />
|
||||
<item android:state_pressed="true" android:drawable="@drawable/album_pressed" />
|
||||
<item android:drawable="@drawable/album" />
|
||||
</selector>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.baidu.paddle.fastdeploy.ui.layout.ActionBarLayout
|
||||
android:id="@+id/action_bar_result"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_in_result"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:cropToPadding="true"
|
||||
android:paddingLeft="40px"
|
||||
android:paddingTop="60px"
|
||||
android:paddingRight="60px"
|
||||
android:paddingBottom="40px"
|
||||
android:src="@drawable/back_btn" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/model_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50px"
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="@dimen/action_btn_text_size" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_settings"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@null"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/btn_settings" />
|
||||
</com.baidu.paddle.fastdeploy.ui.layout.ActionBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="10"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
android:id="@+id/origin_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/bk_result_image_padding" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/colorText" />
|
||||
|
||||
<com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
android:id="@+id/result_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/bk_result_image_padding" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:entries="@array/multiple" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="开始" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_reset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="复位" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/album_select"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginBottom="90dp"
|
||||
android:background="@drawable/album_btn"
|
||||
android:scaleType="fitXY" />
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="@drawable/main_bk"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/model_text"
|
||||
android:layout_width="320dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="120dp"
|
||||
android:background="@color/colorStartBtn"
|
||||
android:gravity="center"
|
||||
android:text="Super Resolution"
|
||||
android:textColor="@color/colorTextWrite"
|
||||
android:textSize="30sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/baidu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/model_text"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="百度FastDeploy"
|
||||
android:textColor="@color/colorTextWrite"
|
||||
android:textSize="22sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/baidu"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="Powered by EasyEdge"
|
||||
android:textColor="@color/colorTextWrite"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<Button
|
||||
|
||||
android:id="@+id/start_ui_activity"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="70dp"
|
||||
android:background="@drawable/round_corner_btn"
|
||||
android:text="@string/start_ui_activity"
|
||||
android:textColor="@color/colorTextWrite"
|
||||
android:textSize="22sp"
|
||||
android:onClick="startActivity"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="95dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/paddle_logo"
|
||||
android:scaleType="centerCrop" />
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,17 @@
|
||||
android:layout_marginTop="50px"
|
||||
android:text="@string/voice_assistant_app_name"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_settings"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@null"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/btn_settings" />
|
||||
</com.baidu.paddle.fastdeploy.ui.layout.ActionBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@@ -36,4 +36,10 @@
|
||||
<item>true</item>
|
||||
<item>false</item>
|
||||
</string-array>
|
||||
<string-array name="multiple">
|
||||
<item>选择放大倍数</item>
|
||||
<item>1倍</item>
|
||||
<item>2倍</item>
|
||||
<item>4倍</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -8,6 +8,7 @@
|
||||
<string name="facedet_app_name">EasyEdge</string>
|
||||
<string name="segmentation_app_name">EasyEdge</string>
|
||||
<string name="voice_assistant_app_name">voice assistant</string>
|
||||
<string name="super_resolution_app_name">Super Resolution</string>
|
||||
<string name="start_ui_activity">开始使用</string>
|
||||
<!-- Keys for PreferenceScreen -->
|
||||
<string name="CHOOSE_PRE_INSTALLED_MODEL_KEY">CHOOSE_INSTALLED_MODEL_KEY</string>
|
||||
@@ -41,6 +42,8 @@
|
||||
<string name="SEGMENTATION_MODEL_DIR_DEFAULT">models/portrait_pp_humansegv2_lite_256x144_inference_model</string>
|
||||
<!-- keypointdetection values -->
|
||||
<string name="KEYPOINT_DETECTION_MODEL_DIR_DEFAULT">models/PP_TinyPose_128x96_infer</string>
|
||||
<string name="VOICE_ASSISTANT_MODEL_DIR_DEFAULT">models</string>
|
||||
<string name="SUPER_RESOLUTION_MODEL_DIR_DEFAULT">models</string>
|
||||
<!-- Other resources values-->
|
||||
<string name="action_bar_take_photo">拍照识别</string>
|
||||
<string name="action_bar_realtime">实时识别</string>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ListPreference
|
||||
android:defaultValue="@string/SUPER_RESOLUTION_MODEL_DIR_DEFAULT"
|
||||
android:key="@string/CHOOSE_PRE_INSTALLED_MODEL_KEY"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="Choose Pre-Installed Models" />
|
||||
<EditTextPreference
|
||||
android:defaultValue="@string/SUPER_RESOLUTION_MODEL_DIR_DEFAULT"
|
||||
android:key="@string/MODEL_DIR_KEY"
|
||||
android:title="Model Dir" />
|
||||
<ListPreference
|
||||
android:defaultValue="@string/CPU_THREAD_NUM_DEFAULT"
|
||||
android:entries="@array/cpu_thread_num_entries"
|
||||
android:entryValues="@array/cpu_thread_num_values"
|
||||
android:key="@string/CPU_THREAD_NUM_KEY"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="CPU Thread Num" />
|
||||
<ListPreference
|
||||
android:defaultValue="@string/CPU_POWER_MODE_DEFAULT"
|
||||
android:entries="@array/cpu_power_mode_entries"
|
||||
android:entryValues="@array/cpu_power_mode_values"
|
||||
android:key="@string/CPU_POWER_MODE_KEY"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="CPU Power Mode" />
|
||||
<ListPreference
|
||||
android:defaultValue="@string/ENABLE_LITE_FP16_MODE_DEFAULT"
|
||||
android:entries="@array/enable_lite_fp16_mode_entries"
|
||||
android:entryValues="@array/enable_lite_fp16_mode_values"
|
||||
android:key="@string/ENABLE_LITE_FP16_MODE_KEY"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="Enable Lite FP16" />
|
||||
</PreferenceScreen>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ListPreference
|
||||
android:defaultValue="@string/VOICE_ASSISTANT_MODEL_DIR_DEFAULT"
|
||||
android:key="@string/CHOOSE_PRE_INSTALLED_MODEL_KEY"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="Choose Pre-Installed Models" />
|
||||
<EditTextPreference
|
||||
android:defaultValue="@string/VOICE_ASSISTANT_MODEL_DIR_DEFAULT"
|
||||
android:key="@string/MODEL_DIR_KEY"
|
||||
android:title="Model Dir" />
|
||||
<ListPreference
|
||||
android:defaultValue="@string/CPU_THREAD_NUM_DEFAULT"
|
||||
android:entries="@array/cpu_thread_num_entries"
|
||||
android:entryValues="@array/cpu_thread_num_values"
|
||||
android:key="@string/CPU_THREAD_NUM_KEY"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="CPU Thread Num" />
|
||||
<ListPreference
|
||||
android:defaultValue="@string/CPU_POWER_MODE_DEFAULT"
|
||||
android:entries="@array/cpu_power_mode_entries"
|
||||
android:entryValues="@array/cpu_power_mode_values"
|
||||
android:key="@string/CPU_POWER_MODE_KEY"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="CPU Power Mode" />
|
||||
<ListPreference
|
||||
android:defaultValue="@string/ENABLE_LITE_FP16_MODE_DEFAULT"
|
||||
android:entries="@array/enable_lite_fp16_mode_entries"
|
||||
android:entryValues="@array/enable_lite_fp16_mode_values"
|
||||
android:key="@string/ENABLE_LITE_FP16_MODE_KEY"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="Enable Lite FP16" />
|
||||
</PreferenceScreen>
|
||||
Reference in New Issue
Block a user