# Upgrade Tensorflow Version tflite-server

Source: https://forum.modalai.com/topic/754/upgrade-tensorflow-version-tflite-server
Category: FAQs (https://forum.modalai.com/category/4/faqs)
Posted: 2022-02-17 15:37:56 UTC by Philemon Benner
Replies: 37 · Views: 13489

## Philemon Benner · 2022-02-17 15:37:56 UTC

Hey,
i am currently trying to make a custom model for tflite-server. I am running into the following error when trying to run inference on the model.
```
Resolved reporter
ERROR: Unsupported data type 14 in tensor

ERROR: Unsupported data type 14 in tensor

ERROR: Unsupported data type 14 in tensor

ERROR: Unsupported data type 14 in tensor

ERROR: Unsupported data type 14 in tensor

ERROR: Unsupported data type 14 in tensor

```
in Stackoverflow there is a suggestion to upgrade tensorflow version. My Question is can i just upgrade the tensorflow version from tflite-server or is it not possible. 
Stackoverflow Link: https://stackoverflow.com/questions/70297027/valueerror-unsupported-data-type-14-in-tensor
Model: Efficcentnet-D0 from model zoo tf2.
PS: It would be nice if you would mention in the docs for custom training that the tflite-server only accepts models with the name of the ones that come with tflite-server, and that when compiling to tflite Input Tensor names vary from model to model.

Update:
Tried the Following Model Zoo TF2 Models:
SSD MobileNet v2 320x320
SSD MobileNet V2 FPNLite 320x320
both having the same Output in Tflite:
```
Loaded model /usr/bin/dnn/ssdlite_mobilenet_v2_coco.tflite
Resolved reporter
INFO: Created TensorFlow Lite delegate for GPU.
GPU acceleration is SUPPORTED on this platform
ERROR: Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors.
Failed to apply delegate

------Setting TFLiteThread to ready!! W: 300 H: 300 C:3
------Popping index 0 frame 872 ...... Queue size: 1

Image resize time:            3.98ms
```
after that it just hangs.

## Reply by Philemon Benner · 2022-02-17 15:52:23 UTC

Also in some Thread in the Forum(i don't find it anymore) you mentioned that tf1 model zoo models work and some of tf2 model zoo worked . Can you tell wich tf2 model zoo Models did work on Voxl.

## Reply by Guest · 2022-02-17 16:41:14 UTC

Hi @Philemon-Benner,

Upgrading the tensorflow version has not been possible yet due to the need for a more current gcc compiler. I plan on trying to get around this, but for now the latest version we can run is 2.2.3. 

For your unsupported data type error, do you know which data type it is complaining about in your model? This may be an easy conversion to something that is supported. 

For the static-sized tensor error, this is either due to a conversion error with undefined input/output tensors or an unsupported operator in your graph that produces a dynamically shaped output. See this conversation: https://github.com/tensorflow/tensorflow/issues/38036. From our [docs](https://docs.modalai.com/voxl-tflite-server/) on using your own model, I explicitly define the input arrays, input shapes, and output arrays in order to create static tensors for input/output. I will update the docs today and try to make this process clearer, including your suggestions. 

On the drop-in functionality of tf1/tf2 model zoo variants, I cannot explicitly say which models work or not since I have not tested every variant. In general though, the tf1 model zoo is a safer resource as many of the tf2 models use unsupported architectures for our current tensorflow version.

## Reply by Philemon Benner · 2022-02-17 17:29:51 UTC (in reply to Guest)

@Matt-Turi Thank you for your fast answer i will have a look into your suggestions

## Reply by Philemon Benner · 2022-02-21 12:36:56 UTC

Update:
So for anyone who is facing the same problems as me.
1. If you want to train using tf2 you can't really take models form tf1 model zoo because tf2 feature extractors are not for the ones in tf1(even if tensorflow mentioned that you can use every tf1 model for later versions maybe outdated)
2. So for tf1 Model Zoo go with tf1 1.15.1 for tf2 Model Zoo just take the newest tf version
3. For tf2 take a ssd model from tf2 model zoo(ssd is only supported in export for tflite use)
4. (Expected that you set up model zoo dir and installed all pip packages for them):
4.1 go to models/research/object_detection
4.2 .use export_tflite_ssd_graph.py 
4.3. use the code mentioned in the docs from modalai to make tflite model
4.4 put the tflite model on the voxl 
4.5 cd to the dir where your_model.tflite is type:
```
mv your_model.tflite /usr/bin/dnn/ssdlite_mobilenet_v2_coco.tflite
```
Why renaming the model?
Somewhere i Modal AI Code for tflite server theres a line that only take model with the name.
If your not renaming it you will get a (Model is not supported Error). 
4.6 Replace the classes in the file beyond with your classes
```
vi /usr/bin/dnn/coco_labels.txt
```
4.7 Run tflite Server 
For me that worked with SSD MobileNet v2 320x320(don't get confused its actually 300x300 don't know why) from:
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md
with the base model given there. Ill have to see if it really works after training.
I will probably make a github repository in the Future when i have time featuring: 
+setting up tf2 and tf1 on your local machine with gpu
+training
+export tflite and put on voxl
because it was such a pain in the ass to setup all this when not being familiar with machine learning, and poor documentation.

## Reply by Philemon Benner · 2022-02-22 15:35:00 UTC

@Matt-Turi  thank you for updating your tflite-server code/documentation to adept better to custom models

## Reply by Guest · 2022-02-22 17:49:39 UTC

@Philemon-Benner no problem, appreciate you sharing some of your problems and solutions as well. Their are quite a few quirks that come with using tensorflow lite, but I strongly recommend setting up two separate virtualenvs on a host pc, one for tf2 and one for tf1 with some helper scripts for things like post training conversion and some of the handy tensorflow model retraining scripts. If that is a bit too confusing, tools like google colab can make your tensorflow workflow a bit easier to manage if you are willing to sacrifice some training speed.

## Reply by Philemon Benner · 2022-02-23 10:04:01 UTC

@Matt-Turi So i tried using your the new tflite-server 0.2.0 first with my own model. It loaded the model succesfully but gave the following error 
```
CUSTOM TFLite_Detection_PostProcess: Operation is not supported.
```
so i thought my model had the wrong postprocessing. But in netron everything looked fine and also quantization was made without errors. So i tried using your ssdlite_mobilnet_v2_coco.tflite same error as above but it still worked for like half a minute but then suddenly hangs and ssh sends broken pipe. Do you know if i installed the dev tflite-server wrong or if it could be something else? Full output of ssdlite_mobilenet_v2_coco.tflite model:
```
voxl:~$ voxl-tflite-server -t -d
Enabling timing mode
Enabling debug mode
=================================================================
skip_n_frames:                    5
=================================================================
model:                            /usr/bin/dnn/ssdlite_mobilenet_v2_coco.tflite
=================================================================
input_pipe:                       /run/mpa/uvc/
=================================================================
delegate:                         gpu
=================================================================
Loaded model /usr/bin/dnn/ssdlite_mobilenet_v2_coco.tflite
Resolved reporter
INFO: Created TensorFlow Lite delegate for GPU.
ERROR: Next operations are not supported by GPU delegate:
CUSTOM TFLite_Detection_PostProcess: Operation is not supported.
First 114 operations will run on the GPU, and the remaining 1 on the CPU.
INFO: Initialized OpenCL-based API.

------VOXL TFLite Server------

Connected to camera server
Detected: 0  person, Confidence:   0.81
Detected: 0  person, Confidence:   0.79
Detected: 0  person, Confidence:   0.78
Detected: 0  person, Confidence:   0.79
Detected: 0  person, Confidence:   0.76
Detected: 0  person, Confidence:   0.75
Detected: 0  person, Confidence:   0.71
Detected: 0  person, Confidence:   0.70
Detected: 0  person, Confidence:   0.72
Detected: 0  person, Confidence:   0.75
Detected: 0  person, Confidence:   0.74
Detected: 0  person, Confidence:   0.79
Detected: 0  person, Confidence:   0.78
Detected: 0  person, Confidence:   0.78
Detected: 0  person, Confidence:   0.78
Detected: 0  person, Confidence:   0.78
Detected: 0  person, Confidence:   0.77
Detected: 0  person, Confidence:   0.78
client_loop: send disconnect: Broken pipe
ubuntu@user:~$ 
```
Installation of tflite-server dev:
```
voxl-configure-opkg dev
opkg update 
opkg install tflite-server 
```
it throws some errros with existing installations but when i repeat the steps above it works.

## Reply by Philemon Benner · 2022-02-23 10:22:18 UTC

Ok so it looks like its crashing when i switch to the voxl-portal tflite camera Stream. It works for 2 or three seconds, i can also see detection, then the voxl completely aborts but i can still reconnect over ssh after aborting so it's not shutting down. 
Details:
System Image: voxl_platform_3-3-0-0.5.0-a
voxl-suite: stable release
Services Used:
        voxl-uvc-server -r 640x512 -f 60 -d : Flir Boson Camera : dev release
        voxl-portal : Avg(GPU): 35%, Avg(CPU): 15% : stable release
        voxl-tflite-server -t -d : dev release

Help would be really appreciated for now i will fall back to the stable tflite-server release. But i would really like to use the new one because it's way better for custom models.

When using my new model on stable tflite-server i am getting a Segmentation Fault.

## Reply by Philemon Benner · 2022-02-23 10:48:47 UTC

Netron Tflite Model In/Output Formats:
![Screenshot from 2022-02-23 11-46-54.png](https://forum.modalai.com/assets/uploads/files/1645613292447-screenshot-from-2022-02-23-11-46-54.png)

## Reply by Philemon Benner · 2022-02-23 11:22:50 UTC

Output of Installation of tflite-server 0.2.0 from dev branch:
Output:
```
voxl:~$ opkg install voxl-tflite-server
Upgrading voxl-tflite-server from 0.1.6 to 0.2.0 on root.
Downloading http://voxl-packages.modalai.com/dev/voxl-tflite-server_0.2.0_202202202255.ipk.
Installing libmodal-pipe (2.1.4) on root.
Downloading http://voxl-packages.modalai.com/dev/libmodal-pipe_2.1.4_202202040134.ipk.
Installing libmodal-json (0.4.0) on root.
Downloading http://voxl-packages.modalai.com/dev/libmodal-json_0.4.0_202202080557.ipk.
To remove package debris, try `opkg remove libmodal-json`.
To re-attempt the install, try `opkg install libmodal-json`.
Collected errors:
 * check_data_file_clashes: Package libmodal-json wants to install file /usr/lib64/libmodal_json.so
	But that file is already provided by package  * libmodal_json
 * check_data_file_clashes: Package libmodal-json wants to install file /usr/include/cJSON.h
	But that file is already provided by package  * libmodal_json
 * check_data_file_clashes: Package libmodal-json wants to install file /usr/include/modal_json.h
	But that file is already provided by package  * libmodal_json
 * check_data_file_clashes: Package libmodal-json wants to install file /usr/lib/libmodal_json.so
	But that file is already provided by package  * libmodal_json
 * check_data_file_clashes: Package libmodal-json wants to install file /usr/bin/modal-test-json
	But that file is already provided by package  * libmodal_json
 * opkg_install_cmd: Cannot install package voxl-tflite-server.
```
This does not work:
```
opkg remove libmodal-json
opkg install libmodal-json
```
But when trying to install again:
```
voxl:~$ opkg install voxl-tflite-server
Upgrading voxl-tflite-server from 0.1.6 to 0.2.0 on root.
Installing voxl-opencv (4.5.5) on root.
```
it installed succesfully

## Reply by Philemon Benner · 2022-02-23 16:51:23 UTC

Have been trying around some other models and got some funny confidences:
```
Detected: 0 person, Confidence:  10.00
Detected: 0 person, Confidence:   0.68
Detected: 0 person, Confidence:   0.73
Detected: 0 person, Confidence:   2.63
Detected: 0 person, Confidence:   1.24
Detected: 0 person, Confidence:   0.98
Detected: 0 person, Confidence:   2.23
Detected: 0 person, Confidence:   0.87
Detected: 0 person, Confidence:   1.26
Detected: 0 person, Confidence:   0.74
Detected: 0 person, Confidence:   0.72
Detected: 0 person, Confidence:   1.34
Detected: 0 person, Confidence:   1.82
Detected: 0 person, Confidence:   0.67
Detected: 0 person, Confidence:   1.50
Detected: 0 person, Confidence:   0.74
Detected: 0 person, Confidence:   1.37
Detected: 0 person, Confidence:   0.89
Detected: 0 person, Confidence:   1.56
Fault address: 0x20
Unknown reason.
Segmentation fault

```
didn't know that you can have a confidence of 1000% :thinking_face: 
Model: SSD ResNet101 V1 FPN 640x640

## Reply by Guest · 2022-02-23 17:51:03 UTC

@Philemon-Benner,

Let me try to address these individually!

1. The "error" complaining
 ```
CUSTOM TFLite_Detection_PostProcess: Operation is not supported. 
```
is simply due to the very last operation of the model not being supported for gpu delegation. This is because it is not a standard op, so it just gets delegated to the cpu with no issues! 

2. The issue with tflite-server hanging is not due to an improper install. I was able to replicate this on my setup using a BAD [apm](https://www.modalai.com/products/apm-to-flight-core-and-voxl-y-cable-mcbl-00011?_pos=1&_sid=4004e33a1&_ss=r), but swapping out with a new one seemed to alleviate this issue. voxl-tflite-server is a fairly power hungry application, so I recommend checking for fraying cables and things of that nature but if you can send a picture of your current setup with cables/batteries etc included that may help debug. In the meantime, if you have another apm or power supply to quickly swap to and test please give that a try. 

3. I personally have not had much luck with the resnet architectures, but I would double check data types and output tensor lengths, because those confidence values seem way off. 

4. One last note, the dev release does not directly support all image formats out of voxl-uvc-server, only IMAGE_FORMAT_NV12 as of now. So, if your camera input is coming in as either IMAGE_FORMAT_YUV422 or IMAGE_FORMAT_YUV422_UYVY you may need to add some extra handling for that.

## Reply by Philemon Benner · 2022-02-23 17:58:41 UTC

@Matt-Turi  thank you for the fast reply again. I will check the apm and Camera server output format tomorrow and also send you a picture of the setup.

## Reply by Philemon Benner · 2022-02-24 08:57:03 UTC

@Matt-Turi  I got it working with changing the apm. Thank you for the suggestion. So i looked up my Camera Supports and it should support nv12 and in voxl-uvc-server it shows the following:
```
uvc_get_stream_ctrl_format_size succeeded for format 2
```
after looking at the voxl-uvc-server:
https://gitlab.com/voxl-public/modal-pipe-architecture/voxl-uvc-server/-/blob/dev/src/main.c 
L: 307 There is a for loop looking for a format to choose and format 2 should be NV12 but for some reason when looking at the stream over voxl-portal i get green stripes in the ouput. Do you know what the problem could be?

The Camera is a Boson 640 Black-White Thermal Camera.

## Reply by Philemon Benner · 2022-02-24 09:07:09 UTC

Here is a Picture of the green stripes:
![Screenshot from 2022-02-24 10-06-21.png](https://forum.modalai.com/assets/uploads/files/1645693615592-screenshot-from-2022-02-24-10-06-21.png)

## Reply by Eric Katzfey (ModalAI staff) · 2022-02-24 16:21:25 UTC (in reply to Philemon Benner)

@Philemon-Benner Can you post the output of ```lsusb```, ```voxl-uvc-server -s```, and ```voxl-uvc-server -d -m -r 640x512```?

## Reply by Philemon Benner · 2022-02-24 16:45:32 UTC

@Eric-Katzfey 
lsusb:
```
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 09cb:4007  
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
```
voxl-uvc-server -s:
```
*** START DEVICE LIST ***

Found device 1

Got device descriptor for 09cb:4007 134275

Found device 09cb:4007

DEVICE CONFIGURATION (09cb:4007/134275) ---
Status: idle
VideoControl:
	bcdUVC: 0x0100
VideoStreaming(1):
	bEndpointAddress: 129
	Formats:
	UncompressedFormat(1)
		  bits per pixel: 12
		  GUID: 4934323000001000800000aa00389b71 (I420)
		  default frame: 1
		  aspect ratio: 0x0
		  interlace flags: 00
		  copy protect: 00
			FrameDescriptor(1)
			  capabilities: 02
			  size: 640x512
			  bit rate: 10592000-235929600
			  max frame size: 491520
			  default interval: 1/60
			  interval[0]: 1/60
			  interval[1]: 1/30
	UncompressedFormat(2)
		  bits per pixel: 16
		  GUID: 5931362000001000800000aa00389b71 (Y16 )
		  default frame: 1
		  aspect ratio: 0x0
		  interlace flags: 00
		  copy protect: 00
			FrameDescriptor(1)
			  capabilities: 02
			  size: 640x512
			  bit rate: 10592000-629145600
			  max frame size: 655360
			  default interval: 1/60
			  interval[0]: 1/60
			  interval[1]: 1/30
	UncompressedFormat(3)
		  bits per pixel: 12
		  GUID: 4e56313200001000800000aa00389b71 (NV12)
		  default frame: 1
		  aspect ratio: 0x0
		  interlace flags: 00
		  copy protect: 00
			FrameDescriptor(1)
			  capabilities: 02
			  size: 640x512
			  bit rate: 10592000-235929600
			  max frame size: 491520
			  default interval: 1/60
			  interval[0]: 1/60
			  interval[1]: 1/30
	UncompressedFormat(4)
		  bits per pixel: 12
		  GUID: 4e56323100001000800000aa00389b71 (NV21)
		  default frame: 1
		  aspect ratio: 0x0
		  interlace flags: 00
		  copy protect: 00
			FrameDescriptor(1)
			  capabilities: 02
			  size: 640x512
			  bit rate: 10592000-235929600
			  max frame size: 491520
			  default interval: 1/60
			  interval[0]: 1/60
			  interval[1]: 1/30
END DEVICE CONFIGURATION

*** END DEVICE LIST ***
```
voxl-uvc-server -d -m -r 640x512:
```
Enabling debug messages
Enabling MPA debug messages
voxl-uvc-server starting
Image resolution 640x512, 30 fps chosen
UVC initialized
Device found
Device opened
uvc_get_stream_ctrl_format_size succeeded for format 2
Streaming starting
Got frame callback! frame_format = 17, width = 640, height = 512, length = 491520, ptr = (nil)
making new fifo /run/mpa/uvc/voxl-tflite-server0
opened new pipe for writing after 3 attempt(s)
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 1
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
 * got image 30
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 40 errno: 0
previous client state was 2
write to ch: 0 id: 0 result: 491520 errno: 0
```

## Reply by Philemon Benner · 2022-02-24 16:51:28 UTC

Just checked the camera on my laptop. Camera it self is working fine
It's also working fine with nv12 format without the green lines:
```
ffplay /dev/video4 -pixel_format nv12 
```
Output:
```
Input #0, video4linux2,v4l2, from '/dev/video4':B sq=    0B f=0/0   
  Duration: N/A, start: 33575.082223, bitrate: 235929 kb/s
    Stream #0:0: Video: rawvideo (NV12 / 0x3231564E), nv12, 640x512, 235929 kb/s, 60 fps, 60 tbr, 1000k tbn, 1000k tbc
```

## Reply by Eric Katzfey (ModalAI staff) · 2022-02-24 18:28:43 UTC (in reply to Philemon Benner)

@Philemon-Benner It looks like voxl-uvc-server is working fine. The error messages seem to be related to voxl-tflite-server and not voxl-uvc-server. Can you use voxl-streamer to stream the output of voxl-uvc-server to VLC and see if there are still green lines? What are you currently using to stream the output of voxl-uvc-server?

## Reply by Eric Katzfey (ModalAI staff) · 2022-02-24 18:33:57 UTC (in reply to Philemon Benner)

@Philemon-Benner I'm guessing that there may be a version mismatch somewhere in there.

## Reply by Philemon Benner · 2022-02-25 07:55:18 UTC (in reply to Eric Katzfey)

@Eric-Katzfey Yeah i will try that today. I'm currently showing the stream with voxl Portal but with the voxl-tflite-server pipe. So voxl-uvc-server --> voxl-tflite-server --> voxl-portal(green lines output).

## Reply by Philemon Benner · 2022-02-25 07:58:11 UTC (in reply to Philemon Benner)

@Eric-Katzfey  what a exactly do you mean with version mismatch, and where. The thing i could think of is tflite server 0.2.0 as seen above in the first try of installation i had some errors because of existing dependencies.

## Reply by Philemon Benner · 2022-02-25 08:09:36 UTC (in reply to Eric Katzfey)

@Eric-Katzfey Ok so i tried using it with voxl-streamer. It's working completely fine. Any suggestions?

## Reply by Philemon Benner · 2022-02-25 09:00:33 UTC

I also tried changing the model but still the same result.

## Reply by Philemon Benner · 2022-02-25 10:57:06 UTC

Update:
So i stepped back to TF1 and trained the ssdlite_mobilenet_v2. It's working great on the drone with tflite-server 0.1.8. Thanks for all the suggestions ·@Matt-Turi . But i am looking forward to using the tflite-server 0.2.0. If you still have suggestions for fixing the green stripes in the new version please let me know, because for custom models the new tflite-version is way easier to integrate and the code is more understandable for me.

## Reply by Eric Katzfey (ModalAI staff) · 2022-02-25 17:00:28 UTC (in reply to Philemon Benner)

@Philemon-Benner Thanks for the follow up on this! We'll take a look.

## Reply by Philemon Benner · 2022-03-02 08:44:18 UTC

@Matt-Turi is there a way to change small stuff in tflite-server code without building from source? Or is there a way to do it over ssh?. I can't access the usb slot from the voxl of the drone. I just wanna change the box color and confidence threshhold.

## Reply by Guest · 2022-03-02 17:04:36 UTC

@Philemon-Benner If you make any changes to the code you will need to rebuild it from source. Once built, you can push this package over ssh either manually or using the  [deploy_to_voxl.sh](https://gitlab.com/voxl-public/modal-pipe-architecture/voxl-tflite-server/-/blob/dev/deploy_to_voxl.sh) script that is up on dev, which has an arg for ssh and send ip. Lines 106 and 107 of the script have the scp and opkg install commands that are used.

## Reply by Philemon Benner · 2022-03-02 17:11:51 UTC (in reply to Guest)

@Matt-Turi Thank you for the fast answer. Then i will build it from source. :thinking_face: But could be a cool feature in the future, if Box Color, Box Thickness and Confidence Threshhold would be in the config file.

## Reply by Guest · 2022-03-02 18:07:32 UTC

@Philemon-Benner great suggestion, I'll add that in soon. As for the green stripes issue seen with the dev version using a Flir Boson camera and voxl-uvc-server, I was able to successfully start and run tflite-server (mobilenetv2 w/gpu) with the same setup and only saw a few green "flickers" every few seconds due to the high input rate (60 fps) of the boson camera. I will work on some handling for this case, but have you tried your latest ssdlite_mobilenet_v2 model with the dev version of voxl-tflite-server (0.2.0)?

## Reply by Philemon Benner · 2022-03-03 09:31:09 UTC (in reply to Guest)

@Matt-Turi No i think because if you just update with opkg just the package is updatet and not the folders like the ones in /usr/bin/dnn where the models are stored. But yeah i will have a look at it. And also is the flickering happening on the in- or output? Because if it's happening in the input the inference results obviously will be less accurate, because of the green stripes.

## Reply by Guest · 2022-03-03 17:06:51 UTC

@Philemon-Benner when you update with opkg, all included files will also be updated including the /usr/bin/dnn/ directory. In regards to v0.2.0, I pushed up a patch yesterday that should fix the flickering (was only on output). As long as the skip_n_frames parameter is set to at least 1 with the boson camera (since it comes in at a fixed 60fps), you should be good to go! 

A note on inference with the  Boson 640 Black-White Thermal Camera, I had some interesting results as the included mobilenet/most general models are not trained on thermal datasets, so keep that in mind when evaluating inference.

## Reply by Philemon Benner · 2022-03-04 09:15:42 UTC (in reply to Guest)

@Matt-Turi yeah thanks for updating that i will definitely try it today. Yeah i know i already trained a complete dataset on thermal camera recordings and it's working like a charm. But really hot things are a source of false detection but i guess that just needs more training. Thank you for all the suggestions you made and for the fast response times. One last Question i'm really interested in how you made the boxes following so clean even with shakey Camera, as if we would inference every frame?

## Reply by Philemon Benner · 2022-03-04 13:47:29 UTC

@Matt-Turi thanks for the update on the dev branch. It's now able to show the stream without any flickering. I also managed to add the conf_tresh and box_thickness to the config file and it works really nice.
![Screenshot from 2022-03-04 14-44-05.png](https://forum.modalai.com/assets/uploads/files/1646401563726-screenshot-from-2022-03-04-14-44-05.png)

## Reply by Philemon Benner · 2022-03-04 16:22:30 UTC

@Matt-Turi is there a way that i can text you in private? I have a question and video material that i want to ask for but it shouldn't be publicly shown.

## Reply by Guest · 2022-03-04 16:57:11 UTC

Hey @Philemon-Benner, great to hear everything is running smoothly! For the smooth detections/ inference every frame, try playing around with the skip_n_frames parameter in the config file, this is there so we can adjust the input data rate to match the max output rate of the model. Running with the -t flag can give you an overview of how much time is needed to process a single frame, and then you can adjust from there. 

Feel free to send me an email at matt.turi@modalai.com for something non-public.

## Reply by Philemon Benner · 2022-03-08 12:46:30 UTC (in reply to Guest)

@Matt-Turi Ok nice i've send an email to you
