Run 20 randomly selected models in dogfood mode am: c726445caf
am: ff4d665f31
Change-Id: I8f4adf79a66adc13894c394376c519e4c5d63709
diff --git a/src/com/android/nn/benchmark/app/NNBenchmark.java b/src/com/android/nn/benchmark/app/NNBenchmark.java
index 2e912f8..273b4be 100644
--- a/src/com/android/nn/benchmark/app/NNBenchmark.java
+++ b/src/com/android/nn/benchmark/app/NNBenchmark.java
@@ -123,7 +123,9 @@
try {
mTest.checkSdkVersion();
} catch (UnsupportedSdkException e) {
- return new BenchmarkResult(e.getMessage());
+ BenchmarkResult r = new BenchmarkResult(e.getMessage());
+ Log.v(TAG, "Test: " + r.toString());
+ return r;
}
mDoingBenchmark = true;
diff --git a/src/com/android/nn/benchmark/app/NNControls.java b/src/com/android/nn/benchmark/app/NNControls.java
index 29e85a1..e953cbb 100644
--- a/src/com/android/nn/benchmark/app/NNControls.java
+++ b/src/com/android/nn/benchmark/app/NNControls.java
@@ -21,6 +21,7 @@
import android.os.Bundle;
import android.os.Parcelable;
import android.text.method.ScrollingMovementMethod;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -35,6 +36,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Random;
public class NNControls extends Activity {
private static final String TAG = NNControls.class.getSimpleName();
@@ -53,23 +55,7 @@
private float mResults[];
private String mInfo[];
- private static final String[] DOGFOOD_MODEL_NAMES = new String[]{
- "tts_float",
- "asr_float",
- "mobilenet_v1_1.0_224_quant_topk_aosp",
- "mobilenet_v1_1.0_224_topk_aosp",
- "mobilenet_v1_0.75_192_quant_topk_aosp",
- "mobilenet_v1_0.75_192_topk_aosp",
- "mobilenet_v1_0.5_160_quant_topk_aosp",
- "mobilenet_v1_0.5_160_topk_aosp",
- "mobilenet_v1_0.25_128_quant_topk_aosp",
- "mobilenet_v1_0.25_128_topk_aosp",
- "mobilenet_v2_0.35_128_topk_aosp",
- "mobilenet_v2_0.5_160_topk_aosp",
- "mobilenet_v2_0.75_192_topk_aosp",
- "mobilenet_v2_1.0_224_topk_aosp",
- "mobilenet_v2_1.0_224_quant_topk_aosp",
- };
+ private static int DOGFOOD_MODELS_PER_RUN = 20;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
@@ -217,10 +203,20 @@
mSettings[SETTING_DISABLE_NNAPI] = false;
// Select dogfood models.
+ long seed = System.currentTimeMillis();
+ Log.v(NNBenchmark.TAG, "Dogfood run seed " + seed);
+ Random random = new Random(seed);
+ int numModelsToSelect = Math.min(DOGFOOD_MODELS_PER_RUN, mTestList.size());
for (int i = 0; i < mTestList.size(); i++) {
- String modelName = TestModels.modelsList().get(i).toString();
- boolean isDogfoodModel = Arrays.asList(DOGFOOD_MODEL_NAMES).contains(modelName);
- mTestListView.setItemChecked(i, isDogfoodModel);
+ mTestListView.setItemChecked(i, false);
+ }
+ while (numModelsToSelect > 0) {
+ int i = random.nextInt(mTestList.size());
+ if (mTestListView.isItemChecked(i)) {
+ continue;
+ }
+ mTestListView.setItemChecked(i, true);
+ numModelsToSelect--;
}
// Run benchmark.