Skip to content

Instantly share code, notes, and snippets.

@ProGamerGov
Created March 15, 2018 21:19
Show Gist options
  • Save ProGamerGov/41fd356be1673ab8bf92aa66fd31fd2d to your computer and use it in GitHub Desktop.
Save ProGamerGov/41fd356be1673ab8bf92aa66fd31fd2d to your computer and use it in GitHub Desktop.
Download VGG models with their FC Layers stripped, and convert them to a PyTorch compatible format
cd models
echo "Downloading model conversion scripts..."
wget -c https://raw.github.com/jcjohnson/cnn-benchmarks/master/convert_model.lua
wget -c https://raw.github.com/jcjohnson/cnn-benchmarks/master/utils.lua
echo "Downloading model prototxt files..."
wget -c https://raw.githubusercontent.com/crowsonkb/style_transfer/master/vgg16.prototxt
wget -c https://raw.githubusercontent.com/crowsonkb/style_transfer/master/vgg19.prototxt
echo "Downloading model files..."
wget -c https://style-transfer.s3-us-west-2.amazonaws.com/vgg16.caffemodel
wget -c https://style-transfer.s3-us-west-2.amazonaws.com/vgg19.caffemodel
echo "Converting caffemodels to PyTorch compatible format..."
th convert_model.lua -input_prototxt vgg16.prototxt -input_caffemodel vgg16.caffemodel -output_t7 vgg16.t7
th convert_model.lua -input_prototxt vgg19.prototxt -input_caffemodel vgg19.caffemodel -output_t7 vgg19.t7
echo "Models sucessfully converted!"
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment