blob: a91a93166bf751cfea397710f8bb56061cafa8a7 [file] [log] [blame]
steniu01bee466b2017-06-21 16:45:41 +01001/**
2@page data_import Importing data from existing models
3
4@tableofcontents
5
6@section caffe_data_extractor Extract data from pre-trained caffe model
7
8One can find caffe <a href="https://github.com/BVLC/caffe/wiki/Model-Zoo">pre-trained models</a> on
9caffe's official github repository.
10
11The caffe_data_extractor.py provided in the @ref scripts folder is an example script that shows how to
12extract the hyperparameter values from a trained model.
13
14@note complex networks might require alter the script to properly work.
15
16@subsection how_to How to use the script
17
18Install caffe following <a href="http://caffe.berkeleyvision.org/installation.html">caffe's document</a>.
19Make sure the pycaffe has been added into the PYTHONPATH.
20
21Download the pre-trained caffe model.
22
23Run the caffe_data_extractor.py script by
24
25 ./caffe_data_extractor.py -m <caffe model> -n <caffe netlist>
26
27For example, to extract the data from pre-trained caffe Alex model to binary file:
28
29 ./caffe_data_extractor.py -m /path/to/bvlc_alexnet.caffemodel -n /path/to/caffe/models/bvlc_alexnet/deploy.prototxt
30
31The script has been tested under Python2.7.
32
33@subsection result What is the expected ouput from the script
34
35If the script run succesfully, it prints the shapes of each layer onto the standard
36output and generates *.dat files containing the weights and biases of each layer.
37
38The @ref arm_compute::utils::load_trained_data shows how one could load
39the weights and biases into tensor from the .dat file by the help of Accessor.
40*/