// TODO. Below device tree file is not available on TM1 board.
// So find another way to get Machine ID.
#define MACHINE_MODEL_PATH "/sys/firmware/devicetree/base/model"
-
+#define TENSOR_SIZE 4
static std::map<std::string, int> Model_Formats = {
{ "caffemodel", INFERENCE_MODEL_CAFFE }, { "pb", INFERENCE_MODEL_TF },
{ "tflite", INFERENCE_MODEL_TFLITE }, { "t7", INFERENCE_MODEL_TORCH },
// data type : float
// tensor shape : 1 * 21 * 2
std::string outputNameCoord("mobilenetv2/coord_refine");
- size_t size = output[outputNameCoord].size / 4;
- for (size_t i = 0; i < size; ++i) {
+ size_t count = output[outputNameCoord].size / TENSOR_SIZE;
+ for (size_t i = 0; i < count; ++i) {
unsigned int value = static_cast<unsigned int>(static_cast<float *>(output[outputNameCoord].buffer)[i] * 100.0f);
if (value != static_cast<unsigned int>(answers[i])) {
std::cout << "coord_refine wrong answer at index[" << i << "]" << std::endl;
show_menu("CLtuner Generator");
char mode[MAX_STR];
- int ret = scanf("%s", mode);
+ int ret = scanf("%2s", mode);
if (strncmp(mode, "q", 1) == 0) {
g_print("exit!\n");
char file_path[MAX_STR];
- ret = scanf("%s", file_path);
+ ret = scanf("%255s", file_path);
if (ret == 0) {
g_print("wrong input.\n");
return -1;