Git Product home page Git Product logo

Comments (6)

Auroragan avatar Auroragan commented on June 2, 2024

Hi,

the value in the dictionary stands for scale for now, which means int_value = scale * fp_value,
the output_exponent value in config json file shoule be -log2(scale)
will export to exponent value in the next version

For your own model, the steps are mostly correct:
1.prepare a float32 model, and convet to onnx model
2. you can basically follow the code in example.py, some modification is needed

model_path = 'mnist_model_example.onnx'

  • change to your own onnx model path

calib_dataset = test_images[0:5000:50]

  • the calibration dataset should be selected from your own validation dataset

3/4. get the out_exponent from -log2(scale) and then setp3, step4 as you said
the step3/4 will be supported in the quantization tool as well for convenience, but it's still testing, you can experiment it by calling export_coefficient_to_cpp(model, pickle_file_path, target_chip, output_path, name). a new version will be released soon.

If there is any question or suggestion, please feel free to let us know

from esp-dl.

PureHing avatar PureHing commented on June 2, 2024

@Auroragan
Hi,
In which dynamic library can I locate this function(export_coefficient_to_cpp), and when will the next version be?

from esp-dl.

Auroragan avatar Auroragan commented on June 2, 2024

Hi, @PureHing

Please check the latest master branch.

the function is in calibrator, you can refer to the code in example.py:
calib.export_coefficient_to_cpp(model_proto, pickle_file_path, 'esp32s3', '.', 'test_mnist', True)

from esp-dl.

PureHing avatar PureHing commented on June 2, 2024

@Auroragan Exporting finish, the output files are: ./test_mnist.cpp, ./test_mnist.hpp,and Does the .npy files is necessary for convert.py?

from esp-dl.

Auroragan avatar Auroragan commented on June 2, 2024

the purpose of convert.py is to convert coefficients which are in .npy files to .cpp and .hpp, which is the same as export_coefficient_to_cpp function

if you can use export_coefficient_to_cpp to convert, you don't need to use convert.py anymore

from esp-dl.

PureHing avatar PureHing commented on June 2, 2024

Thanks much

from esp-dl.

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.