Fix landscape layout.

PiperOrigin-RevId: 195506194
This commit is contained in:
Shashi Shekhar 2018-05-04 19:18:44 -07:00 committed by TensorFlower Gardener
parent f21beadedc
commit 939fc534a4
6 changed files with 87 additions and 110 deletions

View File

@ -13,51 +13,55 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#bb7700" android:background="#bb7700"
android:orientation="horizontal" android:orientation="horizontal">
android:weightSum="100">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="30"
android:orientation="vertical">
<com.example.android.tflitecamerademo.AutoFitTextureView <com.example.android.tflitecamerademo.AutoFitTextureView
android:id="@+id/texture" android:id="@+id/texture"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="100" /> android:layout_weight=".8"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".2"
android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/logoview" android:id="@+id/logoview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="@drawable/logo"/>
<ToggleButton
android:id="@+id/button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="100" android:textOff="@string/tflite"
android:scaleType="centerCrop" android:textOn="@string/nnapi"/>
android:src="@drawable/logo" /> <NumberPicker
android:id="@+id/np"
</LinearLayout> android:layout_width="wrap_content"
android:layout_height="47dp"
android:layout_gravity="center_horizontal"
android:visibility="visible"/>
<TextView <TextView
android:id="@+id/text" android:id="@+id/text"
android:textStyle="bold"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="70"
android:paddingLeft="5dp"
android:paddingTop="20dp" android:paddingTop="20dp"
android:textColor="#FFF" android:textColor="#FFF"
android:textSize="20sp" android:textSize="20sp"/>
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -15,45 +15,47 @@
--> -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:background="#bb7700">
android:weightSum="60">
<FrameLayout
android:id="@+id/control"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_weight="60"
android:background="#cc7700"
android:paddingLeft="20dp"
android:paddingStart="20dp">
</FrameLayout>
<com.example.android.tflitecamerademo.AutoFitTextureView <com.example.android.tflitecamerademo.AutoFitTextureView
android:id="@+id/texture" android:id="@+id/texture"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="false"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentLeft="true" android:layout_alignParentTop="false"
android:layout_alignParentTop="true" /> android:background="#bb7700"
android:orientation="vertical"
android:weightSum="100">
<ImageView
android:id="@+id/logoview2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="30"
android:scaleType="fitStart"
android:src="@drawable/logo" />
<TextView <TextView
android:id="@+id/text" android:id="@+id/text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_weight="20" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_weight="30"
android:textColor="#FFF" android:textColor="#FFF"
android:textSize="20sp" android:textSize="20sp"
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<RelativeLayout <RelativeLayout
@ -83,33 +85,4 @@
android:layout_below="@+id/button" android:layout_below="@+id/button"
android:visibility="visible" /> android:visibility="visible" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/control2"
android:layout_width="match_parent"
android:layout_height="135dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="@+id/control"
android:layout_marginLeft="300dp"
android:layout_marginStart="300dp"
android:background="@color/control_background">
<ToggleButton
android:id="@+id/button"
android:textOff="@string/tflite"
android:textOn="@string/nnapi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<NumberPicker
android:id="@+id/np"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button"
android:visibility="visible" />
</RelativeLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -23,7 +23,7 @@ android_binary(
deps = [ deps = [
"//tensorflow/contrib/lite/java:ovicbenchmarkerlib", "//tensorflow/contrib/lite/java:ovicbenchmarkerlib",
"//tensorflow/contrib/lite/java:tensorflowlite", "//tensorflow/contrib/lite/java:tensorflowlite",
"//third_party/java/android/android_sdk_linux/extras/android/compatibility/v13", "@androidsdk//com.android.support:support-v13-25.2.0",
"//third_party/java/android/android_sdk_linux/extras/android/compatibility/v4", "@androidsdk//com.android.support:support-v4-25.2.0",
], ],
) )

View File

@ -45,17 +45,17 @@ public final class OvicClassifierTest {
private ByteBuffer lowResTestImage = null; private ByteBuffer lowResTestImage = null;
private OvicSingleImageResult testResult = null; private OvicSingleImageResult testResult = null;
private static final String LABELS_PATH = private static final String LABELS_PATH =
"third_party/tensorflow/contrib/lite/java/ovic/src/testdata/labels.txt"; "tensorflow/contrib/lite/java/ovic/src/testdata/labels.txt";
private static final String QUANTIZED_MODEL_PATH = private static final String QUANTIZED_MODEL_PATH =
"third_party/tensorflow/contrib/lite/java/ovic/src/testdata/quantized_model.lite"; "external/tflite_ovic_testdata/quantized_model.lite";
private static final String LOW_RES_MODEL_PATH = private static final String LOW_RES_MODEL_PATH =
"third_party/tensorflow/contrib/lite/java/ovic/src/testdata/low_res_model.lite"; "external/tflite_ovic_testdata/low_res_model.lite";
private static final String FLOAT_MODEL_PATH = private static final String FLOAT_MODEL_PATH =
"third_party/tensorflow/contrib/lite/java/ovic/src/testdata/float_model.lite"; "external/tflite_ovic_testdata/float_model.lite";
private static final String TEST_IMAGE_PATH = private static final String TEST_IMAGE_PATH =
"third_party/tensorflow/contrib/lite/java/ovic/src/testdata/test_image_224.jpg"; "external/tflite_ovic_testdata/test_image_224.jpg";
private static final String TEST_LOW_RES_IMAGE_PATH = private static final String TEST_LOW_RES_IMAGE_PATH =
"third_party/tensorflow/contrib/lite/java/ovic/src/testdata/test_image_128.jpg"; "external/tflite_ovic_testdata/test_image_128.jpg";
private static final int TEST_IMAGE_GROUNDTRUTH = 653; // "military uniform" private static final int TEST_IMAGE_GROUNDTRUTH = 653; // "military uniform"
@Before @Before

View File

@ -4,11 +4,11 @@ licenses(["notice"]) # Apache 2.0
filegroup( filegroup(
name = "ovic_testdata", name = "ovic_testdata",
srcs = [ srcs = [
"float_model.lite", "@tflite_ovic_testdata//:float_model.lite",
"low_res_model.lite", "@tflite_ovic_testdata//:low_res_model.lite",
"quantized_model.lite", "@tflite_ovic_testdata//:quantized_model.lite",
"test_image_128.jpg", "@tflite_ovic_testdata//:test_image_128.jpg",
"test_image_224.jpg", "@tflite_ovic_testdata//:test_image_224.jpg",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )