Skip to content

Commit 574522f

Browse files
committed
Adding YAML examples for tensorflow filter doc. Part of issue #1872.
Signed-off-by: Eric D. Schabell <[email protected]>
1 parent 68fdca3 commit 574522f

File tree

1 file changed

+43
-10
lines changed

1 file changed

+43
-10
lines changed

pipeline/filters/tensorflow.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ The plugin supports the following configuration parameters:
2525
To create a Tensorflow Lite shared library:
2626

2727
1. Clone the [Tensorflow repository](https://github.com/tensorflow/tensorflow).
28-
1. Install the [Bazel](https://bazel.build/) package manager.
29-
1. Run the following command to create the shared library:
28+
2. Install the [Bazel](https://bazel.build/) package manager.
29+
3. Run the following command to create the shared library:
3030

31-
```bash
32-
bazel build -c opt //tensorflow/lite/c:tensorflowlite_c # see https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/c
31+
```shell
32+
$ ./bazel build -c opt //tensorflow/lite/c:tensorflowlite_c # see https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/c
3333
```
3434

3535
The script creates the shared library
3636
`bazel-bin/tensorflow/lite/c/libtensorflowlite_c.so`.
37-
1. Copy the library to a location such as `/usr/lib` that can be used by Fluent Bit.
37+
4. Copy the library to a location such as `/usr/lib` that can be used by Fluent Bit.
3838

3939
## Building Fluent Bit with Tensorflow filter plugin
4040

4141
The Tensorflow filter plugin is disabled by default. You must build Fluent Bit with the Tensorflow plugin enabled. In addition, it requires access to Tensorflow Lite header files to compile. Therefore, you must pass the address of the Tensorflow source code on your machine to the [build script](https://github.com/fluent/fluent-bit#build-from-scratch):
4242

43-
```bash
44-
cmake -DFLB_FILTER_TENSORFLOW=On -DTensorflow_DIR=<AddressOfTensorflowSourceCode> ...
43+
```shell
44+
$ ./cmake -DFLB_FILTER_TENSORFLOW=On -DTensorflow_DIR=<AddressOfTensorflowSourceCode> ...
4545
```
4646

4747
### Command line
@@ -50,8 +50,8 @@ If Tensorflow plugin initializes correctly, it reports successful creation of th
5050

5151
The command:
5252

53-
```bash
54-
bin/fluent-bit -i mqtt -p 'tag=mqtt.data' -F tensorflow -m '*' -p 'input_field=image' -p 'model_file=/home/user/model.tflite' -p
53+
```shell
54+
$ ./fluent-bit -i mqtt -p 'tag=mqtt.data' -F tensorflow -m '*' -p 'input_field=image' -p 'model_file=/home/user/model.tflite' -p
5555
```
5656

5757
produces an output like:
@@ -67,7 +67,37 @@ produces an output like:
6767

6868
### Configuration file
6969

70-
```python
70+
{% tabs %}
71+
{% tab title="fluent-bit.yaml" %}
72+
73+
```yaml
74+
service:
75+
flush: 1
76+
daemon: off
77+
log_level: info
78+
79+
pipeline:
80+
inputs:
81+
- name: mqtt
82+
tag: mqtt.data
83+
84+
filters:
85+
- name: tensorflow
86+
match: mqtt.data
87+
input_field: image
88+
model_file: /home/m/model.tflite
89+
include_input_fields: false
90+
normalization_value: 255
91+
92+
outputs:
93+
- name: stdout
94+
match: '*'
95+
```
96+
97+
{% endtab %}
98+
{% tab title="fluent-bit.conf" %}
99+
100+
```text
71101
[SERVICE]
72102
Flush 1
73103
Daemon Off
@@ -89,3 +119,6 @@ produces an output like:
89119
Name stdout
90120
Match *
91121
```
122+
123+
{% endtab %}
124+
{% endtabs %}

0 commit comments

Comments
 (0)