tree: a5030c322e4a6b6641f2e0c6fd43e33d5d518bac [path history] [tgz]
  1. public/
  2. BUILD.gn
  3. decision_tree_predictor.cc
  4. decision_tree_predictor.h
  5. decision_tree_predictor_unittest.cc
  6. DEPS
  7. features.gni
  8. in_process_tflite_predictor.cc
  9. in_process_tflite_predictor.h
  10. in_process_tflite_predictor_unittest.cc
  11. machine_learning_service.cc
  12. machine_learning_service.h
  13. machine_learning_service_unittest.cc
  14. metrics.cc
  15. metrics.h
  16. OWNERS
  17. README.md
chrome/services/machine_learning/README.md

Chrome Machine Learning Service

This is a service for sandboxed evaluations of machine learning models. (Design doc)

To build Chrome with TFLite library follow these instructions. For the unit test we use a simple tflite model. This is a simple sequential model as following:

input_shape = (32, 32, 3)
model = tf.keras.models.Sequential([
    tf.keras.Input(shape=input_shape, dtype=np.float32),
    tf.keras.layers.Conv2D(16, 3, strides=(1, 1), activation='relu', padding='same', 
    input_shape=input_shape),
    tf.keras.layers.MaxPooling2D((2, 2)),
    tf.keras.layers.Flatten(),
    tf.keras.layers.Dense(10),
])

Build Tensorflow Lite library:

clone https://github.com/tensorflow/tensorflow

cd tensorflow

for x86 architecture:

bazel build tensorflow/lite/c:libtensorflowlite_c.so

for android:

bazel build --config=android_arm64 tensorflow/lite/c:libtensorflowlite_c.so

copy ‘libtensorflowlite_c.so’ file to chromium/src/third_party/tensorflow

link the library to a soft link in system library directory under /lib/

Copy libraries:

c_api.h and common.h here to into third_party/tensorflow/lite/c

Build TFLite in chrome:

Set flag build_with_tflite_lib=true

Uncomment thirdparty library in machine learning header file.