Merge pull request #39404 from freedomtan:reformat_cleanup_label_image_readme

PiperOrigin-RevId: 312833154
Change-Id: Ifa241950299da888472c1b6f7c47dd1828183c12
This commit is contained in:
TensorFlower Gardener 2020-05-22 08:30:50 -07:00
commit b96ec1082d
2 changed files with 29 additions and 15 deletions

View File

@ -111,27 +111,41 @@ uniform 0.0379589: 907 Windsor tie 0.00735866: 466 bulletproof vest 0.00605307:
To run a model with the Hexagon Delegate, assuming we have followed the To run a model with the Hexagon Delegate, assuming we have followed the
[Hexagon Delegate Guide](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/performance/hexagon_delegate.md) [Hexagon Delegate Guide](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/performance/hexagon_delegate.md)
and installed Hexagon libraries in `/data/local/tmp`. Run it `adb shell and installed Hexagon libraries in `/data/local/tmp`. Run it wth (`-j 1`) `adb
"/data/local/tmp/label_image \ -m shell \ "/data/local/tmp/label_image \ -m
/data/local/tmp/mobilenet_v1_1.0_224_quant.tflite \ -i /data/local/tmp/mobilenet_v1_1.0_224_quant.tflite \ -i
/data/local/tmp/grace_hopper.bmp \ -l /data/local/tmp/labels.txt -j 1"` then you /data/local/tmp/grace_hopper.bmp \ -l /data/local/tmp/labels.txt -j 1"` then you
should see something like the followings: ``` Loaded model should see something like the followings: ``` Loaded model
/data/local/tmp/mobilenet_v1_1.0_224_quant.tflite resolved reporter INFO: /data/local/tmp/mobilenet_v1_1.0_224_quant.tflite resolved reporter INFO:
Initialized TensorFlow Lite runtime. INFO: Created TensorFlow Lite delegate for Initialized TensorFlow Lite runtime. loaded libcdsprpc.so INFO: Created
Hexagon. INFO: Hexagon delegate: 31 nodes delegated out of 31 nodes. TensorFlow Lite delegate for Hexagon. INFO: Hexagon delegate: 31 nodes delegated
out of 31 nodes with 1 partitions.
remote_handle_control available and used Applied Hexagon delegate.invoked Applied Hexagon delegate.invoked average time: 4.231 ms 0.639216: 458 bow tie
average time: 8.307 ms 0.729412: 653 military uniform 0.0980392: 907 Windsor tie 0.329412: 653 military uniform 0.00784314: 835 suit 0.00784314: 611 jersey
0.0313726: 466 bulletproof vest 0.0313726: 458 bow tie 0.0117647: 700 panpipe 0.00392157: 514 cornet ```
```
Run the model with the XNNPACK delegate (`-x 1`), `adb shell Run the model with the XNNPACK delegate (`-x 1`), `adb shell \
"/data/local/tmp/label_image \ -m /data/local/tmp/mobilenet_v1_1.0_224.tflite \ "/data/local/tmp/label_image \ -m /data/local/tmp/mobilenet_v1_1.0_224.tflite \
-i /data/local/tmp/grace_hopper.bmp \ -l /data/local/tmp/labels.txt -x 1"` then -i /data/local/tmp/grace_hopper.bmp \ -l /data/local/tmp/labels.txt -x 1"` then
you should see something like the followings: `Loaded model you should see something like the followings: `Loaded model
/data/local/tmp/mobilenet_v1_1.0_224.tflite resolved reporter INFO: Initialized /data/local/tmp/mobilenet_v1_1.0_224.tflite resolved reporter INFO: Initialized
TensorFlow Lite runtime. Applied XNNPACK delegate.invoked average time: 11.0237 TensorFlow Lite runtime. Applied XNNPACK delegate.invoked average time: 17.33 ms
ms 0.90707: 653 military uniform 0.0372418: 907 Windsor tie 0.0073376: 466 0.90707: 653 military uniform 0.0372418: 907 Windsor tie 0.0073376: 466
bulletproof vest 0.00592856: 458 bow tie 0.00414093: 514 cornet` bulletproof vest 0.00592857: 458 bow tie 0.00414093: 514 cornet`
With `-h` or any other unsupported flags, `label_image` will list supported
options `sargo:/data/local/tmp $ ./label_image -h ./label_image: invalid
option -- h label_image --accelerated, -a: [0|1], use Android NNAPI or not
--old_accelerated, -d: [0|1], use old Android NNAPI delegate or not
--allow_fp16, -f: [0|1], allow running fp32 models with fp16 or not --count, -c:
loop interpreter->Invoke() for certain times --gl_backend, -g: [0|1]: use GL GPU
Delegate on Android --hexagon_delegate, -j: [0|1]: use Hexagon Delegate on
Android --input_mean, -b: input mean --input_std, -s: input standard deviation
--image, -i: image_name.bmp --labels, -l: labels for the model --tflite_model,
-m: model_name.tflite --profiling, -p: [0|1], profiling or not --num_results,
-r: number of results to show --threads, -t: number of threads --verbose, -v:
[0|1] print more information --warmup_runs, -w: number of warmup runs
--xnnpack_delegate, -x [0:1]: xnnpack delegate`
See the `label_image.cc` source code for other command line options. See the `label_image.cc` source code for other command line options.

View File

@ -362,8 +362,8 @@ void display_usage() {
<< "--old_accelerated, -d: [0|1], use old Android NNAPI delegate or not\n" << "--old_accelerated, -d: [0|1], use old Android NNAPI delegate or not\n"
<< "--allow_fp16, -f: [0|1], allow running fp32 models with fp16 or not\n" << "--allow_fp16, -f: [0|1], allow running fp32 models with fp16 or not\n"
<< "--count, -c: loop interpreter->Invoke() for certain times\n" << "--count, -c: loop interpreter->Invoke() for certain times\n"
<< "--gl_backend, -g: use GL GPU Delegate on Android\n" << "--gl_backend, -g: [0|1]: use GL GPU Delegate on Android\n"
<< "--hexagon_delegate: use Hexagon Delegate on Android\n" << "--hexagon_delegate, -j: [0|1]: use Hexagon Delegate on Android\n"
<< "--input_mean, -b: input mean\n" << "--input_mean, -b: input mean\n"
<< "--input_std, -s: input standard deviation\n" << "--input_std, -s: input standard deviation\n"
<< "--image, -i: image_name.bmp\n" << "--image, -i: image_name.bmp\n"
@ -374,7 +374,7 @@ void display_usage() {
<< "--threads, -t: number of threads\n" << "--threads, -t: number of threads\n"
<< "--verbose, -v: [0|1] print more information\n" << "--verbose, -v: [0|1] print more information\n"
<< "--warmup_runs, -w: number of warmup runs\n" << "--warmup_runs, -w: number of warmup runs\n"
<< "--xnnpack_delegate, -x: xnnpack delegate\n" << "--xnnpack_delegate, -x [0:1]: xnnpack delegate\n"
<< "\n"; << "\n";
} }