A demo to show converting caffe models on 'imagenet' using caffe2fluid --- # How to use 1. Prepare python environment 2. Download caffe model to "models.caffe/xxx" which contains "xxx.caffemodel" and "xxx.prototxt" 3. Convert the Caffe model to Fluid model - generate fluid code and weight file
python convert.py alexnet.prototxt \
--caffemodel alexnet.caffemodel \
--data-output-path alexnet.npy \
--code-output-path alexnet.py
- save weights as fluid model file
python alexnet.py alexnet.npy ./fluid_model
4. Do inference
python infer.py infer ./fluid_mode data/65.jpeg
5. convert model and do inference together
bash ./run.sh alexnet ./models.caffe/alexnet ./models/alexnet
The Caffe model is stored in './models.caffe/alexnet/alexnet.prototxt|caffemodel'
and the Fluid model will be save in './models/alexnet/alexnet.py|npy'
6. test the difference with caffe's results(need pycaffe installed)
bash ./diff.sh resnet
Make sure your caffemodel stored in './models.caffe/resnet'.
The results will be stored in './results/resnet.paddle|caffe'