GithubHelp home page GithubHelp logo

Densify ? about tflite2tensorflow HOT 8 CLOSED

geaxgx avatar geaxgx commented on May 22, 2024
Densify ?

from tflite2tensorflow.

Comments (8)

PINTO0309 avatar PINTO0309 commented on May 22, 2024 3

Commited. TFLite Float32/Float16, EdgeTPU, ONNX, OpenVINO IR, Myriad Blob, TF-TRT, TFJS, CoreML.
https://github.com/PINTO0309/PINTO_model_zoo/tree/main/053_BlazePose/20_densify_pose_detection

from tflite2tensorflow.

PINTO0309 avatar PINTO0309 commented on May 22, 2024 2

After analyzing the TensorFlow implementation, it seems that I need to implement the following additional steps in the following order. It's going to take some time.

  1. https://www.tensorflow.org/api_docs/python/tf/sparse/SparseTensor
  2. https://www.tensorflow.org/api_docs/python/tf/sparse/to_dense
  3. https://github.com/tensorflow/tensorflow/blob/5d442828288614d57062f77d8af5d5b090b21469/tensorflow/lite/kernels/internal/reference/densify.h#L29-L43
  4. https://github.com/tensorflow/tensorflow/blob/a6b6df2de94421ecdb1baa97aca3ffca74ee04ad/tensorflow/lite/tools/optimize/sparsity/format_converter.cc#L215-L256
template <typename T>
inline void Densify(const TfLiteSparsity* sparsity,
                    const RuntimeShape& input_shape, const T* input_data,
                    const RuntimeShape& output_shape, T* output_data,
                    TfLiteContext* context) {
  const int dims_count = output_shape.DimensionsCount();
  std::vector<int> vector_shape(dims_count);
  for (int i = 0; i < dims_count; i++) {
    vector_shape[i] = output_shape.Dims(i);
  }

  tflite::optimize::sparsity::FormatConverter<T> converter(vector_shape, *sparsity);
  converter.SparseToDense(input_data, output_shape.FlatSize(), output_data, context);
}

from tflite2tensorflow.

geaxgx avatar geaxgx commented on May 22, 2024 2

Thanks @PINTO0309 ! As I said before, take your time. I can play with the previous version.

I guess Densify allows a smaller size of the model on disk, but probably not in memory :-)

from tflite2tensorflow.

MrNeither avatar MrNeither commented on May 22, 2024 1

@geaxgx Sorry for the trouble, it's just in another committee there is)

from tflite2tensorflow.

MrNeither avatar MrNeither commented on May 22, 2024

@geaxgx I get the same problem. Could you please give a link to the previous version of the model, which can be converted with tflite2tensorflow?

from tflite2tensorflow.

PINTO0309 avatar PINTO0309 commented on May 22, 2024

https://github.com/PINTO0309/PINTO_model_zoo/tree/main/053_BlazePose

from tflite2tensorflow.

PINTO0309 avatar PINTO0309 commented on May 22, 2024

Fixes: f032b31

This is an experimental implementation at the moment, so it is not well tested.

tflite2tensorflow v1.11.7 https://github.com/PINTO0309/tflite2tensorflow/releases/tag/v1.11.7
model_float32 tflite (2)

from tflite2tensorflow.

geaxgx avatar geaxgx commented on May 22, 2024

Thanks @PINTO0309 !

from tflite2tensorflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.