Skip to content

Example which compares pretrained TF model, checkpoint of TF model and pytorch model converted from checkpoint.

License

Notifications You must be signed in to change notification settings

ryfeus/tensorflow2pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

tensorflow2pytorch

Example which compares pretrained TF model, checkpoint of TF model and pytorch model converted from checkpoint.

Download and convert model

We will be using MMdnn library (https://github.com/Microsoft/MMdnn) to download and convert model. For example to download and convert VGG19 model you need to do the following:

mmdownload -f tensorflow -n vgg19
mmconvert -sf tensorflow -in imagenet_vgg19.ckpt.meta -iw imagenet_vgg19.ckpt --dstNodeName MMdnn_Output -df pytorch -om tf_vgg19_to_pth.pth

Compare model results

You can use index.py to compare models' predictions. You will need to keep in mind the following parameters:

Tensorflow pretrained model:

  • *.tfmodel file - strModelPath parameter
  • model name - strModelName parameter
  • name of input tensor - strTensor parameter
  • input dict for the model - dictModelInput parameter
  • name of output tensor - strModelInputTensor parameter

Tensorflow checkpoint:

  • *.ckpt.meta file - strModelMetaPath parameter
  • *.ckpt file - strModelCheckpointPath parameter
  • name of input tensor - strTensor parameter
  • input dict for the model - dictModelInput parameter
  • name of output tensor - strModelInputTensor parameter

Pytorch checkpoint:

  • *.py file - strModelMetaPath parameter
  • *.pth file - strModelCheckpointPath parameter

Input images:

  • paths to images - vecPaths parameter

About

Example which compares pretrained TF model, checkpoint of TF model and pytorch model converted from checkpoint.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages