Avatar for user122861

user122861

Member since Dec 2020 • Last active Jan 2021
  • 1 conversations
  • 5 comments

Most recent activity

  • in Bangle.js
    Avatar for user122861
    var tf = require("tensorflow").create(3072, model);
    
    function get_data(a){
    
    var d = [Math.round(a.x*100),Math.round(a.y*100)­,Math.round(a.z*100)];
      
    input_array.push(d);
    
    
    if (input_array.length > SAMPLE_SIZE-1){
    
    
    var row_array = [];
    var time_step_array = [];
    var final_input = [];
    var depth_array = [];
    
    for (i=0; i<input_array.length;i++){
        row_array = [];
        depth_array = [];
    
    for (j=0;j<input_array[0].length;j++){
        depth_array.push(input_array[i][j]);  
    }
    row_array.push(depth_array);
    time_step_array.push(row_array);
    }
    
    final_input.push(time_step_array);
    
    
    tf.getInput().set(final_input);
    
    //Terminal.println(tf.getInput());
    
    tf.invoke();
    
    Terminal.println(tf.getOutput());
    
    input_array = [];
    
    }
    
    
    }
    
    
    Bangle.on('accel', get_data);
    
    

    This is my code and my model takes input as array i am always getting the same output when printed. I am pretty sure there is no problem in model as i loaded the tflite model and tested the output in my desktop and it is working fine.

  • in Bangle.js
    Avatar for user122861

    Hi @Gordon thanks for the reply
    so you mean my model input should be always a flat 1D array and then internal conversion should be made while creating model. Currently the my input_array is 4D array so can i directly input this to the model or should i recreate my model to take only 1D array inputs.

  • in Bangle.js
    Avatar for user122861

    I have a tflite model which expects the input to be in int8 datatype

    var tf = require("tensorflow").create(2048, model);
    tf.getInput()[0] = input_array;
    tf.invoke();
    print(tf.getOutput()[0]);
    

    I have loaded my data in the same shape as my model expects but when i print (tf.getInput()[0] ) it always shows zero even when input_array has values. I have encoded my model with base64. Can anyone help me out @Gordon please help me out here

    Also tflite has standard get_tensor and set_tensor functions in interpreter to set the input data in proper format. I cannot see those functions in banglejs after loading the tflite model.

  • in Bangle.js
    Avatar for user122861

    I followed the https://github.com/espruino/Espruino/tre­e/master/libs/tensorflow#actually-using-­it and it created a tflite model, my model has less 1024 parameters.
    However i get an error

    
    Uncaught Error: Didn't find op for builtin opcode 'ADD' version '1'
    

    I used tensorflow 2.0 to create model

    @Gordon can you please suggest way forward

  • in Bangle.js
    Avatar for user122861

    Hi ,
    I have created my custom gesture recognition model and converted to tflite model but my input to model is a array of 4D how can we actually convert input stream into the format

    tf.getInput()[0] = x;
    
Actions