Skip to content

Instantly share code, notes, and snippets.

View WesleyCh3n's full-sized avatar
😺

WesleyCh3n WesleyCh3n

😺
View GitHub Profile
@WesleyCh3n
WesleyCh3n / opencv_to_tflite.cpp
Last active August 25, 2023 15:53
Tensorflow Lite using cv::Mat as input (MobileNetV2)- C++ & Python
/* tflite model:
* - input shape: (224,224,3)
* - output shape: (128)
* In C++, cv::Mat should be flatten as input. If input has 3 channel,
* then it should be RGBRGBRGB... */
#include <iostream>
#include <iomanip>
#include "tensorflow/lite/interpreter.h"
{
"embeddings": [
{
"tensorName": "Cow-embedding",
"tensorShape": [
1900,
128
],
"tensorPath": "https://gist.githubusercontent.com/WesleyCh3n/4825bb479d7cd7f329f69be35cde9a46/raw/5c9cf355ca63598dca629e15f21ff775a860db56/Tflite-vecs.tsv",
"metadataPath": "https://gist.githubusercontent.com/WesleyCh3n/4fb70cf0b34b0c1b6a6026985e54d282/raw/6e8fca7f808f1bb65a1c84b8376ecec1b940383f/Tflite-metas.tsv"