Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.
/ paddle-vgg16 Public archive

VGG16 model for PaddlePaddle, converted from Caffe

Notifications You must be signed in to change notification settings

oraoto/paddle-vgg16

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VGG16 model for PaddlePaddle

The model is converted from Caffe model VGG_ILSVRC_16_layers, using caffe2fluid.

Usage

  1. Clone this repo

    git clone https://github.com/oraoto/paddle-vgg16.git

    or simply download the model definition: vgg16.py

  2. Download the params

  3. Extract the params to models/vgg16, the resulting folder structure should looks like:

    .
    ├── vgg16.py
    ├── infer.py
    ├── models
    │   ├── vgg16
    │   │   ├── conv1_1_biases
    │   │   ├── conv1_1_weights
    │   │   ├── conv1_2_biases
    │   │   │....
    
    
  4. Load params (see infer.py for full example)

    from vgg16 import VGG16
    import paddle.fluid as fluid
    
    img = fluid.layers.data('img', shape=[3, 224, 224])
    predict = VGG16(include_top=True, infer=True).net(img)
    
    exe = fluid.Executor(fluid.CPUPlace())
    # All params are prefiexed with `vgg16` to avoid confliction,
    # load params from `models` rather than `models/vgg16`
    fluid.io.load_params(exe, "models") 
  5. Optional: Do inference on an image:

    python infer.py path/to/your/image
    

    Example output:

    $ python infer.py images/zebra_wikipedia.jpg
    Using TensorFlow backend.
    zebra: 0.999809205532
    impala: 0.000101726756839
    hartebeest: 4.52961321571e-05
    gazelle: 3.82991747756e-05
    ostrich: 3.12061411023e-06
    

About

VGG16 model for PaddlePaddle, converted from Caffe

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages