-
-
Notifications
You must be signed in to change notification settings - Fork 42
Densify ? #11
Comments
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.
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);
} |
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 :-) |
@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? |
@geaxgx Sorry for the trouble, it's just in another committee there is) |
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 |
Commited. TFLite Float32/Float16, EdgeTPU, ONNX, OpenVINO IR, Myriad Blob, TF-TRT, TFJS, CoreML. |
Thanks @PINTO0309 ! |
1. Ubuntu 18.04
2. OS Architecture x86_64
3. OpenVINO e.g. 2021.4.582
9. Download URL for .tflite IR model https://github.com/google/mediapipe/blob/master/mediapipe/modules/pose_detection/pose_detection.tflite
Hi @PINTO0309 !
New mediapipe version 0.8.6 comes with new models for Blazepose (that's a never ending story :-)
The size of the pose detection model (link above) has been significantly reduced (from ~7.5MB to ~3MB) but unfortunately the model is using a layer named Densify that is not implemented in tflite2tensorflow. I guess it is a relatively new layer. When trying to visualize its data in Netron, I get an "Invalid tensor data size" message.
Do you think Densify can be easily implemented in your tools ? Note that it is not something I am eagerly waiting for since I can do without it by using the previous version of the pose detection model.
The text was updated successfully, but these errors were encountered: