Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if(NOT DEFINED TENSORFLOW)
set(TF_CHECKOUT true)
endif()

# find Git and use it to get backscrub version
# find Git and use it to get backscrub & Tensorflow versions
find_package(Git)
if(GIT_FOUND)
execute_process(
Expand All @@ -22,7 +22,7 @@ if(GIT_FOUND)
else()
set(DEEPSEG_VERSION v0.2.0-no-git)
endif()
message("Version: ${DEEPSEG_VERSION}")
message("Backscrub version: ${DEEPSEG_VERSION}")

# always build PIC everywhere
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
Expand All @@ -42,6 +42,18 @@ else()
message(STATUS "Using specified Tensorflow: ${TENSORFLOW}")
endif(TF_CHECKOUT)

if(GIT_FOUND)
get_filename_component(TF_ABS ${TENSORFLOW} ABSOLUTE)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --all --long --always --dirty
WORKING_DIRECTORY ${TF_ABS}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE TF_VERSION)
else()
set(TF_VERSION unknown-no-git)
endif()
message(STATUS "Tensorflow version: ${TF_VERSION}")

# force compilation of XNNPACK delegate (without this the too clever-by-half use
# of weak/strong symbol linking fails in a static library)
add_compile_definitions(TFLITE_BUILD_WITH_XNNPACK_DELEGATE)
Expand Down
1 change: 1 addition & 0 deletions app/deepseg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ int main(int argc, char* argv[]) try {
printf("%s version %s\n", argv[0], _STR(DEEPSEG_VERSION));
printf("(c) 2021 by floe@butterbrot.org & contributors\n");
printf("https://github.com/floe/backscrub\n");
printf("(running with Tensorflow Lite version: %s)\n", bs_tensorflow_version());
timinginfo_t ti;
ti.bootns = timestamp();
int debug = 0;
Expand Down
5 changes: 5 additions & 0 deletions lib/libbackscrub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Authors - @see AUTHORS file.
==============================================================================*/

#include "tensorflow/lite/version.h"
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include "tensorflow/lite/model.h"
Expand Down Expand Up @@ -146,6 +147,10 @@ static normalization_t get_normalization(modeltype_t type) {
return rv;
}

const char *bs_tensorflow_version(void) {
return TFLITE_VERSION_STRING;
}

// deeplabv3 classes
// TODO: read from model metadata file
static const std::vector<std::string> labels = { "background", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "dining table", "dog", "horse", "motorbike", "person", "potted plant", "sheep", "sofa", "train", "tv" };
Expand Down
3 changes: 3 additions & 0 deletions lib/libbackscrub.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>

// Get Tensorflow version string
extern const char *bs_tensorflow_version(void);

// Return a new (opaque) mask generation context
extern void *bs_maskgen_new(
// Required parameters
Expand Down