Rename Tensorflow Android example java classes to TensorFlow to fix native

method binding error.
Change: 127585524
This commit is contained in:
Andrew Harp 2016-07-15 14:28:09 -08:00 committed by TensorFlower Gardener
parent 19181afb32
commit 194efde518
3 changed files with 12 additions and 12 deletions

View File

@ -424,7 +424,7 @@ public class CameraConnectionFragment extends Fragment {
backgroundThread = new HandlerThread("ImageListener"); backgroundThread = new HandlerThread("ImageListener");
backgroundThread.start(); backgroundThread.start();
backgroundHandler = new Handler(backgroundThread.getLooper()); backgroundHandler = new Handler(backgroundThread.getLooper());
inferenceThread = new HandlerThread("InferenceThread"); inferenceThread = new HandlerThread("InferenceThread");
inferenceThread.start(); inferenceThread.start();
inferenceHandler = new Handler(inferenceThread.getLooper()); inferenceHandler = new Handler(inferenceThread.getLooper());
@ -440,7 +440,7 @@ public class CameraConnectionFragment extends Fragment {
backgroundThread.join(); backgroundThread.join();
backgroundThread = null; backgroundThread = null;
backgroundHandler = null; backgroundHandler = null;
inferenceThread.join(); inferenceThread.join();
inferenceThread = null; inferenceThread = null;
inferenceThread = null; inferenceThread = null;
@ -449,7 +449,7 @@ public class CameraConnectionFragment extends Fragment {
} }
} }
private final TensorflowImageListener tfPreviewListener = new TensorflowImageListener(); private final TensorFlowImageListener tfPreviewListener = new TensorFlowImageListener();
private final CameraCaptureSession.CaptureCallback captureCallback = private final CameraCaptureSession.CaptureCallback captureCallback =
new CameraCaptureSession.CaptureCallback() { new CameraCaptureSession.CaptureCallback() {
@ -539,7 +539,7 @@ public class CameraConnectionFragment extends Fragment {
LOGGER.i("Getting assets."); LOGGER.i("Getting assets.");
tfPreviewListener.initialize( tfPreviewListener.initialize(
getActivity().getAssets(), scoreView, inferenceHandler, sensorOrientation); getActivity().getAssets(), scoreView, inferenceHandler, sensorOrientation);
LOGGER.i("Tensorflow initialized."); LOGGER.i("TensorFlow initialized.");
} }
/** /**

View File

@ -27,11 +27,11 @@ import java.util.StringTokenizer;
/** /**
* JNI wrapper class for the Tensorflow native code. * JNI wrapper class for the Tensorflow native code.
*/ */
public class TensorflowClassifier implements Classifier { public class TensorFlowClassifier implements Classifier {
private static final String TAG = "TensorflowClassifier"; private static final String TAG = "TensorflowClassifier";
// jni native methods. // jni native methods.
public native int initializeTensorflow( public native int initializeTensorFlow(
AssetManager assetManager, AssetManager assetManager,
String model, String model,
String labels, String labels,

View File

@ -37,7 +37,7 @@ import java.util.List;
/** /**
* Class that takes in preview frames and converts the image to Bitmaps to process with Tensorflow. * Class that takes in preview frames and converts the image to Bitmaps to process with Tensorflow.
*/ */
public class TensorflowImageListener implements OnImageAvailableListener { public class TensorFlowImageListener implements OnImageAvailableListener {
private static final Logger LOGGER = new Logger(); private static final Logger LOGGER = new Logger();
private static final boolean SAVE_PREVIEW_BITMAP = false; private static final boolean SAVE_PREVIEW_BITMAP = false;
@ -61,7 +61,7 @@ public class TensorflowImageListener implements OnImageAvailableListener {
private Integer sensorOrientation; private Integer sensorOrientation;
private final TensorflowClassifier tensorflow = new TensorflowClassifier(); private final TensorFlowClassifier tensorflow = new TensorFlowClassifier();
private int previewWidth = 0; private int previewWidth = 0;
private int previewHeight = 0; private int previewHeight = 0;
@ -69,10 +69,10 @@ public class TensorflowImageListener implements OnImageAvailableListener {
private int[] rgbBytes = null; private int[] rgbBytes = null;
private Bitmap rgbFrameBitmap = null; private Bitmap rgbFrameBitmap = null;
private Bitmap croppedBitmap = null; private Bitmap croppedBitmap = null;
private boolean computing = false; private boolean computing = false;
private Handler handler; private Handler handler;
private RecognitionScoreView scoreView; private RecognitionScoreView scoreView;
public void initialize( public void initialize(
@ -81,7 +81,7 @@ public class TensorflowImageListener implements OnImageAvailableListener {
final Handler handler, final Handler handler,
final Integer sensorOrientation) { final Integer sensorOrientation) {
Assert.assertNotNull(sensorOrientation); Assert.assertNotNull(sensorOrientation);
tensorflow.initializeTensorflow( tensorflow.initializeTensorFlow(
assetManager, MODEL_FILE, LABEL_FILE, NUM_CLASSES, INPUT_SIZE, IMAGE_MEAN, IMAGE_STD, assetManager, MODEL_FILE, LABEL_FILE, NUM_CLASSES, INPUT_SIZE, IMAGE_MEAN, IMAGE_STD,
INPUT_NAME, OUTPUT_NAME); INPUT_NAME, OUTPUT_NAME);
this.scoreView = scoreView; this.scoreView = scoreView;
@ -123,7 +123,7 @@ public class TensorflowImageListener implements OnImageAvailableListener {
if (image == null) { if (image == null) {
return; return;
} }
// No mutex needed as this method is not reentrant. // No mutex needed as this method is not reentrant.
if (computing) { if (computing) {
image.close(); image.close();