-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deployment (without docker run) + Bench and AC configs
- Loading branch information
1 parent
2f79dee
commit 4deaaa9
Showing
2 changed files
with
209 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
#!/bin/bash | ||
|
||
while getopts l:p: flag | ||
do | ||
case "${flag}" in | ||
l) login=${OPTARG};; | ||
p) password=${OPTARG};; | ||
esac | ||
done | ||
|
||
echo "[ INFO ] Demo application has been started" | ||
demo_folder="$PWD" | ||
root_folder="${demo_folder}/.." | ||
openvino_version="2022.1.0" | ||
|
||
echo "[ INFO ] Creation server has been started" | ||
server_folder="${demo_folder}/server" | ||
[ -d $server_folder ] && rm -rf $server_folder | ||
mkdir $server_folder && cd $server_folder | ||
echo "[ INFO ] Cloning of DLB repository" | ||
dlb_server="${server_folder}/dl-benchmark" | ||
git clone https://github.com/itlab-vision/dl-benchmark.git | ||
echo "[ INFO ] Creation server has been completed" | ||
|
||
echo "[ INFO ] Creation of client has been started" | ||
echo "[ INFO ] Creation client folder" | ||
client_folder="${demo_folder}/client" | ||
[ -d $client_folder ] && rm -rf $client_folder | ||
mkdir $client_folder | ||
cd $client_folder | ||
echo "[ INFO ] Cloning of DLB repository" | ||
dlb_client="${client_folder}/dl-benchmark" | ||
[ -d $dlb_client ] && rm -rf $dlb_client | ||
git clone https://github.com/itlab-vision/dl-benchmark.git | ||
echo "[ INFO ] Cloning of OMZ repository" | ||
omz_client="${client_folder}/open_model_zoo" | ||
[ -d $omz_client ] && rm -rf $omz_client | ||
git clone https://github.com/openvinotoolkit/open_model_zoo.git --recursive --branch $openvino_version --single-branch | ||
models_dir="${omz_client}/tools/accuracy_checker/data/test_models" | ||
echo "[ INFO ] Download dataset 'cifar-10-python'" | ||
wget https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz | ||
mkdir dataset && tar xvf cifar-10-python.tar.gz -C dataset | ||
dataset_dir="${omz_client}/dataset" | ||
rm -rf cifar-10-python.tar.gz | ||
echo "[ INFO ] Creation of client has been been completed" | ||
|
||
echo "[ INFO ] Creation of Docker image has been started" | ||
cd $root_folder/docker/OpenVINO_DLDT | ||
apt install docker.io | ||
image_name="openvino:${openvino_version}" | ||
docker build -t $image_name . | ||
echo "[ INFO ] Creation of archive with Docker image" | ||
archive_name="openvino_${openvino_version}.tar" | ||
docker save $image_name > $archive_name | ||
archive_path="$PWD/$archive_name" | ||
echo "[ INFO ] Archive ${archive_path} has been created" | ||
echo "[ INFO ] Creation of Docker image has been completed" | ||
|
||
echo "[ INFO ] Deployment of DLB system has been started" | ||
cd $demo_folder | ||
ip_address=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p') | ||
echo "[ INFO ] IP-address of the host: ${ip_address}" | ||
echo "[ INFO ] Configuration creation for deployment module" | ||
deployment_config="${PWD}/deploy_config.xml" | ||
[ -f $deployment_config ] && rm -rf $deployment_config | ||
echo \ | ||
"<?xml version=\"1.0\" encoding=\"utf-8\" ?> | ||
<Computers> | ||
<Computer> | ||
<IP>${ip_address}</IP> | ||
<Login>${login}</Login> | ||
<Password>itmm</Password> | ||
<OS>Linux</OS> | ||
<DownloadFolder>${client_folder}</DownloadFolder> | ||
<DatasetFolder>${dataset_dir}</DatasetFolder> | ||
<ModelFolder>${models_dir}</ModelFolder> | ||
</Computer> | ||
</Computers>" \ | ||
>> $deployment_config | ||
echo "[ INFO ] Launch deploy.py script" | ||
cd $root_folder/src/deployment | ||
python3 deploy.py -s $ip_address -l $login -p itmm \ | ||
-i $archive_path \ | ||
-d $server_folder \ | ||
-n OpenVINO_DLDT \ | ||
--machine_list $deployment_config \ | ||
--project_folder $dlb_server | ||
echo "[ INFO ] Deployment of DLB system has been completed" | ||
|
||
echo "[ INFO ] Preparing configuration for benchmarking" | ||
cd $demo_folder | ||
benchmark_config="benchmark_config.xml" | ||
benchmark_config_path="${PWD}/${benchmark_config}" | ||
[ -f $benchmark_config_path ] && rm -rf $benchmark_config_path | ||
task="test" | ||
model_name="SampleNet" | ||
model_xml="/mnt/models/SampLeNet.xml" | ||
model_bin="/mnt/models/SampLeNet.xml" | ||
framework="OpenVINO DLDT" | ||
device="CPU" | ||
echo \ | ||
"<?xml version=\"1.0\" encoding=\"utf-8\"?> | ||
<Tests> | ||
<Test> | ||
<Model> | ||
<Task>${task}</Task> | ||
<Name>${model_name}</Name> | ||
<Precision>FP32</Precision> | ||
<SourceFramework>Caffe</SourceFramework> | ||
<ModelPath>${model}</ModelPath> | ||
<WeightsPath>${model_bin}</WeightsPath> | ||
</Model> | ||
<Dataset> | ||
<Name>ImageNET</Name> | ||
<Path>/tmp/itlab-vision-dl-benchmark-data/Datasets/ImageNET/</Path> | ||
</Dataset> | ||
<FrameworkIndependent> | ||
<InferenceFramework>${framework}</InferenceFramework> | ||
<BatchSize>1</BatchSize> | ||
<Device>${device}</Device> | ||
<IterationCount>10</IterationCount> | ||
<TestTimeLimit>180</TestTimeLimit> | ||
</FrameworkIndependent> | ||
<FrameworkDependent> | ||
<Mode>sync</Mode> | ||
<Extension></Extension> | ||
<AsyncRequestCount></AsyncRequestCount> | ||
<ThreadCount></ThreadCount> | ||
<StreamCount></StreamCount> | ||
</FrameworkDependent> | ||
</Test> | ||
<Test> | ||
<Model> | ||
<Task>${task}</Task> | ||
<Name>${model_name}</Name> | ||
<Precision>FP32</Precision> | ||
<SourceFramework>Caffe</SourceFramework> | ||
<ModelPath>${model}</ModelPath> | ||
<WeightsPath>${model_bin}</WeightsPath> | ||
</Model> | ||
<Dataset> | ||
<Name>ImageNET</Name> | ||
<Path>/tmp/itlab-vision-dl-benchmark-data/Datasets/ImageNET/</Path> | ||
</Dataset> | ||
<FrameworkIndependent> | ||
<InferenceFramework>${framework}</InferenceFramework> | ||
<BatchSize>1</BatchSize> | ||
<Device>${device}</Device> | ||
<IterationCount>10</IterationCount> | ||
<TestTimeLimit>180</TestTimeLimit> | ||
</FrameworkIndependent> | ||
<FrameworkDependent> | ||
<Mode>async</Mode> | ||
<Extension></Extension> | ||
<AsyncRequestCount></AsyncRequestCount> | ||
<ThreadCount></ThreadCount> | ||
<StreamCount></StreamCount> | ||
</FrameworkDependent> | ||
</Test> | ||
</Tests>" \ | ||
>> $benchmark_config_path | ||
echo "[ INFO ] Model: ${model_xml}" | ||
echo "[ INFO ] Weights: ${model_bin}" | ||
echo "[ INFO ] Framework: ${framework}" | ||
echo "[ INFO ] Device: ${device}" | ||
echo "[ INFO ] Modes: latency, throughput" | ||
|
||
echo "[ INFO ] Preparing configuration for accuracy checker" | ||
accuracy_checker_config="accuracy_checker_config.xml" | ||
accuracy_checker_config_path="${PWD}/${accuracy_checker_config}" | ||
[ -f $accuracy_checker_config_path ] && rm -rf $accuracy_checker_config_path | ||
model_path="/mnt/models" | ||
config_path="${omz_client}/sample/sample_config.yml" | ||
echo \ | ||
"<?xml version=\"1.0\" encoding=\"utf-8\"?> | ||
<Tests> | ||
<Test> | ||
<Model> | ||
<Task>${task}</Task> | ||
<Name>${model_name}</Name> | ||
<Precision>FP32</Precision> | ||
<SourceFramework>Caffe</SourceFramework> | ||
<Directory>${model_path}</Directory> | ||
</Model> | ||
<Parameters> | ||
<InferenceFramework>${framework}</InferenceFramework> | ||
<Device>${device}</Device> | ||
<Config>${config_path}</Config> | ||
</Parameters> | ||
</Test> | ||
</Tests>" \ | ||
>> $accuracy_checker_config_path | ||
echo "[ INFO ] Model: ${model_name}" | ||
echo "[ INFO ] Framework: ${framework}" | ||
echo "[ INFO ] Device: ${device}" | ||
echo "[ INFO ] Config: ${config_path}" | ||
|
||
echo "[ INFO ] Copying of benchmark configuration file ${benchmark_config_path} to server" | ||
# use cp instead of scp because scp asks password | ||
cp $benchmark_config_path $server_folder/$benchmark_config | ||
echo "[ INFO ] Copying of accuracy checker configuration ${accuracy_checker_config_path} file to server" | ||
# use cp instead of scp because scp asks password | ||
cp $accuracy_checker_config_path $server_folder/$accuracy_checker_config | ||
|
||
cd $demo_folder | ||
|
||
# TODO: Add removing files after demonstration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters