Improve the format in Support Library examples.
PiperOrigin-RevId: 283055924 Change-Id: I89b3062cb0bc07afc888d1b7774cf5d54aeda2e0
This commit is contained in:
parent
99cb9fd68d
commit
764a3ab93a
@ -114,8 +114,9 @@ try{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Running inference
|
// Running inference
|
||||||
if(null != tflite)
|
if(null != tflite) {
|
||||||
tflite.run(tImage.getBuffer(), probabilityBuffer.getBuffer());
|
tflite.run(tImage.getBuffer(), probabilityBuffer.getBuffer());
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Accessing the result
|
### Accessing the result
|
||||||
@ -138,9 +139,9 @@ import org.tensorflow.lite.support.common.FileUtil;
|
|||||||
final String ASSOCIATED_AXIS_LABELS = "labels.txt";
|
final String ASSOCIATED_AXIS_LABELS = "labels.txt";
|
||||||
List<String> associatedAxisLabels = null;
|
List<String> associatedAxisLabels = null;
|
||||||
|
|
||||||
try{
|
try {
|
||||||
associatedAxisLabels = FileUtil.loadLabels(this, ASSOCIATED_AXIS_LABELS);
|
associatedAxisLabels = FileUtil.loadLabels(this, ASSOCIATED_AXIS_LABELS);
|
||||||
} catch (IOException e){
|
} catch (IOException e) {
|
||||||
Log.e("tfliteSupport", "Error reading label file", e);
|
Log.e("tfliteSupport", "Error reading label file", e);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -192,11 +193,11 @@ int size = height > width ? width : height;
|
|||||||
ImageProcessor imageProcessor =
|
ImageProcessor imageProcessor =
|
||||||
new ImageProcessor.Builder()
|
new ImageProcessor.Builder()
|
||||||
// Center crop the image to the largest square possible
|
// Center crop the image to the largest square possible
|
||||||
.add(new ResizeWithCropOrPadOp(size , size))
|
.add(new ResizeWithCropOrPadOp(size, size))
|
||||||
// Resize using Bilinear or Nearest neighbour
|
// Resize using Bilinear or Nearest neighbour
|
||||||
.add(new ResizeOp(224, 224, ResizeOp.ResizeMethod.BILINEAR));
|
.add(new ResizeOp(224, 224, ResizeOp.ResizeMethod.BILINEAR));
|
||||||
// Rotation counter-clockwise in 90 degree increments
|
// Rotation counter-clockwise in 90 degree increments
|
||||||
.add(new Rot90Op(rotateDegrees/90))
|
.add(new Rot90Op(rotateDegrees / 90))
|
||||||
.build();
|
.build();
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -229,5 +230,5 @@ TensorProcessor probabilityProcessor =
|
|||||||
new TensorProcessor.Builder().add(new NormalizeOp(0, 255)).build();
|
new TensorProcessor.Builder().add(new NormalizeOp(0, 255)).build();
|
||||||
|
|
||||||
// Post-processor which dequantize the result
|
// Post-processor which dequantize the result
|
||||||
TensorBuffer dequantizedBuffer = probabilityProcessor.process(probabilityBuffer)
|
TensorBuffer dequantizedBuffer = probabilityProcessor.process(probabilityBuffer);
|
||||||
```
|
```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user