The model is converted from Caffe model VGG_ILSVRC_19_layers_deploy.prototxt and VGG_ILSVRC_19_layers.caffemodel, using caffe2fluid.
*If you want to use the whole model for the program, you can use load_inference_model to load the model. 1.Download model and params.
-
Extract the model and params from the link, and the folder structure should looks like:
.
├── vgg19_model
├── vgg19_params
2.Usage
- Extract the tar in the inference_model/ dir
- You can use directly:
program, feed_names, fetch_targets = fluid.io.load_inference_model('./VGG19_pd_model_param',
exe, 'vgg19_model', 'vgg19_params')
- You can see more detail in inference_model/infer.py
If you want to just load the param and realize your own model to use and add the loss like me:
- example:
(when I reimplement the SRGAN, the loss of Generator is three parts, g_loss = mse_loss + vgg_loss + g_gan_loss
I need the vgg_api in the g_program.:+1:
So you can just use the load param.
fluid.io.load_params(exe, "./vgg19_pd_params")
- See more detail in load_params
- You can download the params in different files link for params
- PS. The way I save the param in different files:
fluid.io.save_persistables(exe,'./save_para/', inference_program)
Thanks for oraoto! I refer his code which is converted the vgg16 for paddlepaddle.