ARM-software / ML-examples

Arm Machine Learning tutorials and examples
https://developer.arm.com/technologies/machine-learning-on-arm
Apache License 2.0
437 stars 195 forks source link

Quantization and Code generator Script #44

Open vinuraj1010 opened 4 years ago

vinuraj1010 commented 4 years ago

Hi all,

I would like to know whether the nn_quantizer.py and code_gen.py works for all caffe models with specified restrictions.

As an example:

  1. In NXP mnist example, they are mentioning like nn_quantizer as it is doesn't work for MNIST.
  2. In some other github issues, it is mentioned that code_gen.py is not working as expected for mnist.

Please guide me through this.

I was planning to develop a NN model for mcu. If caffe model can be converted for mcu, it will be better for me. otherwise I have to go for tensorflow lite.

ando2097 commented 3 years ago

I have also found that the nn_quantiser.py script does not work for alexnet trained mnist models giving the following error after using the command:


I0818 18:21:19.810953 3404 net.cpp:202] label_mnist_1_split does not need backward computation. I0818 18:21:19.810956 3404 net.cpp:202] mnist does not need backward computation. I0818 18:21:19.810959 3404 net.cpp:244] This network produces output accuracy I0818 18:21:19.810962 3404 net.cpp:244] This network produces output loss I0818 18:21:19.810972 3404 net.cpp:257] Network initialization done. Traceback (most recent call last): File "nn_quantizer.py", line 614, in my_model.get_graph_connectivity() File "nn_quantizer.py", line 232, in get_graph_connectivity current_blob = self.bottom_blob[current_layer][0] IndexError: list index out of range

ython3 nn_quantizer.py --model models/mnist/lenet_train_test.prototxt --weights models/mnist/lenet_iter_10000.caffemodel --save models/mnist/lenet_mnist.pkl