Commit a53626b2 authored by Dan Wilcox's avatar Dan Wilcox
Browse files

update example model download script to fetch single models as commandline arg

parent b7ab3f1f
#! /bin/sh
#
# script to download pre-trained models for the example projects
# script to download pre-trained models for the example projects,
# downloads all models by default or individual provide zip files by name:
# download_example_models.sh model_basics
#
# requires: curl, unzip
#
......@@ -15,6 +17,12 @@ URL=https://cloud.zkm.de/index.php/s/gfWEjyEr9X4gyY6
SRC=example_models
DEST=../..
# download target
DOWNLOAD="all"
if [ "$1" != "" ] ; then
DOWNLOAD=$1
fi
##### functions
# download from a public NextCloud shared link
......@@ -22,7 +30,12 @@ DEST=../..
# $2: filename
download() {
local path="download?path=%2F&files=$2"
curl -LO $URL/$path
RETCODE=$(curl -LO -w "%{http_code}" $URL/$path)
if [ "$RETCODE" != "200" ] ; then
echo "download failed: HTTP $RETCODE"
rm -rf $path
return
fi
mkdir -p $SRC
mv $path $SRC/$2
}
......@@ -33,60 +46,93 @@ download() {
cd $(dirname "$0")
# download models
download $URL model_basics.zip
download $URL model_basics_multi_IO.zip
download $URL model_effnet.zip
download $URL model_keywordspotting.zip
download $URL model_multi_pose.zip
download $URL model_pix2pix_edges2shoes_20epochs.zip
download $URL models_style_transfer_640x480.zip
download $URL model_video_matting.zip
case "$DOWNLOAD" in
all)
echo "ka"
download $URL model_basics.zip
download $URL model_basics_multi_IO.zip
download $URL model_basics_frozen_graph.zip
download $URL model_effnet.zip
download $URL model_keywordspotting.zip
download $URL model_multi_pose.zip
download $URL model_pix2pix_edges2shoes_20epochs.zip
download $URL models_style_transfer_640x480.zip
download $URL model_video_matting.zip
;;
*)
echo "lala"
download $URL ${DOWNLOAD}.zip
;;
esac
cd "$SRC"
# example_basics
unzip model_basics.zip
rm -rf "$DEST"/example_basics/bin/data/model
mv model "$DEST"/example_basics/bin/data
if [ -f model_basics.zip ] ; then
unzip model_basics.zip
rm -rf "$DEST"/example_basics/bin/data/model
mv model "$DEST"/example_basics/bin/data
fi
# example_basics_frozen_graph
if [ -f model_basics_frozen_graph.zip ] ; then
unzip model_basics_frozen_graph.zip
rm -rf "$DEST"/example_basics_frozen_graph/bin/data/model.pb
mv model.pb "$DEST"/example_basics_frozen_graph/bin/data
fi
# example_basics_multi_IO
unzip model_basics_multi_IO.zip
rm -rf "$DEST"/example_basics_multi_IO/bin/data/model
mv model "$DEST"/example_basics_multi_IO/bin/data
if [ -f model_basics_multi_IO.zip ] ; then
unzip model_basics_multi_IO.zip
rm -rf "$DEST"/example_basics_multi_IO/bin/data/model
mv model "$DEST"/example_basics_multi_IO/bin/data
fi
# example_effnet
unzip model_effnet.zip
rm -rf "$DEST"/example_basics_efficientnet/bin/data/model
mv model "$DEST"/example_basics_efficientnet/bin/data
if [ -f model_effnet.zip ] ; then
unzip model_effnet.zip
rm -rf "$DEST"/example_basics_efficientnet/bin/data/model
mv model "$DEST"/example_basics_efficientnet/bin/data
fi
# example_keywordspotting
unzip model_keywordspotting.zip
rm -rf "$DEST"/example_keyword_spotting/bin/data/model
mv model "$DEST"/example_keyword_spotting/bin/data
if [ -f model_keywordspotting.zip ] ; then
unzip model_keywordspotting.zip
rm -rf "$DEST"/example_keyword_spotting/bin/data/model
mv model "$DEST"/example_keyword_spotting/bin/data
fi
# example_movenet
unzip model_multi_pose.zip
rm -rf "$DEST"/example_movenet/bin/data/model
mv model "$DEST"/example_movenet/bin/data
if [ -f model_multi_pose.zip ] ; then
unzip model_multi_pose.zip
rm -rf "$DEST"/example_movenet/bin/data/model
mv model "$DEST"/example_movenet/bin/data
fi
# example_pix2pix
unzip model_pix2pix_edges2shoes_20epochs.zip
rm -rf "$DEST"/example_pix2pix/bin/data/model
mv model "$DEST"/example_pix2pix/bin/data
if [ -f model_pix2pix_edges2shoes_20epochs.zip ] ; then
unzip model_pix2pix_edges2shoes_20epochs.zip
rm -rf "$DEST"/example_pix2pix/bin/data/model
mv model "$DEST"/example_pix2pix/bin/data
fi
# example_style_transfer
unzip models_style_transfer_640x480.zip
rm -rf "$DEST"/example_style_transfer/bin/data/models
mv models "$DEST"/example_style_transfer/bin/data
if [ -f models_style_transfer_640x480.zip ] ; then
unzip models_style_transfer_640x480.zip
rm -rf "$DEST"/example_style_transfer/bin/data/models
mv models "$DEST"/example_style_transfer/bin/data
fi
# example_video_matting
unzip model_video_matting.zip
rm -rf "$DEST"/example_video_matting/bin/data/model
rm -rf "$DEST"/example_video_matting/bin/data/codylexi.mp4
rm -rf "$DEST"/example_video_matting/bin/data/bg.jpg
mv model "$DEST"/example_video_matting/bin/data
mv codylexi.mp4 "$DEST"/example_video_matting/bin/data
mv bg.jpg "$DEST"/example_video_matting/bin/data
if [ -f model_video_matting.zip ] ; then
unzip model_video_matting.zip
rm -rf "$DEST"/example_video_matting/bin/data/model
rm -rf "$DEST"/example_video_matting/bin/data/codylexi.mp4
rm -rf "$DEST"/example_video_matting/bin/data/bg.jpg
mv model "$DEST"/example_video_matting/bin/data
mv codylexi.mp4 "$DEST"/example_video_matting/bin/data
mv bg.jpg "$DEST"/example_video_matting/bin/data
fi
# cleanup
cd ../
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment