mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-10-31 09:26:52 +00:00 
			
		
		
		
	metrics: Add Tensorflow Mobilenet documentation
This PR adds the Tensorflow mobilinet documentation for the machine learning README. Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
		| @@ -27,3 +27,20 @@ Individual tests can be run by hand, for example: | |||||||
| $ cd metrics/machine_learning | $ cd metrics/machine_learning | ||||||
| $ ./tensorflow.sh 40 100 | $ ./tensorflow.sh 40 100 | ||||||
| ``` | ``` | ||||||
|  | # Kata Containers Tensorflow `MobileNet` Metrics | ||||||
|  |  | ||||||
|  | `MobileNets` are small, low-latency, low-power models parameterized to meet the resource  | ||||||
|  | constraints of a variety of use cases. They can be built upon for classification, detection,  | ||||||
|  | embeddings and segmentation similar to how other popular large scale models, such as Inception, are used.  | ||||||
|  | `MobileNets` can be run efficiently on mobile devices with `Tensorflow` Lite. | ||||||
|  |  | ||||||
|  | Kata Containers provides a test for running `MobileNet V1` inference using Intel-Optimized `Tensorflow`. | ||||||
|  |  | ||||||
|  | ## Running the `Tensorflow` `MobileNet` test | ||||||
|  | Individual test can be run by hand, for example: | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | $ cd metrics/machine_learning | ||||||
|  | $ ./tensorflow_mobilenet_benchmark.sh 25 60 | ||||||
|  | ``` | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ | |||||||
| # | # | ||||||
| # SPDX-License-Identifier: Apache-2.0 | # SPDX-License-Identifier: Apache-2.0 | ||||||
|  |  | ||||||
| set -o pipefial | set -o pipefail | ||||||
|  |  | ||||||
| # General env | # General env | ||||||
| SCRIPT_PATH=$(dirname "$(readlink -f "$0")") | SCRIPT_PATH=$(dirname "$(readlink -f "$0")") | ||||||
| @@ -22,7 +22,7 @@ TESTDIR="${TESTDIR:-/testdir}" | |||||||
| dst_dir="/host" | dst_dir="/host" | ||||||
| src_dir=$(mktemp --tmpdir -d tensorflowai.XXXXXXXXXX) | src_dir=$(mktemp --tmpdir -d tensorflowai.XXXXXXXXXX) | ||||||
| MOUNT_OPTIONS="type=bind,src=$src_dir,dst=$dst_dir,options=rbind:ro" | MOUNT_OPTIONS="type=bind,src=$src_dir,dst=$dst_dir,options=rbind:ro" | ||||||
| start_script="mobilnet_start.sh" | start_script="mobilenet_start.sh" | ||||||
| # CMD points to the script that starts the workload | # CMD points to the script that starts the workload | ||||||
| CMD="$dst_dir/$start_script" | CMD="$dst_dir/$start_script" | ||||||
| guest_trigger_file="$dst_dir/$trigger_file" | guest_trigger_file="$dst_dir/$trigger_file" | ||||||
| @@ -100,13 +100,13 @@ function mobilenet_test() { | |||||||
| 		sudo -E "${CTR_EXE}" t exec --exec-id "$(random_name)" "${i}" sh -c "${CMD_RESULTS}"  >> "${tensorflow_file}" | 		sudo -E "${CTR_EXE}" t exec --exec-id "$(random_name)" "${i}" sh -c "${CMD_RESULTS}"  >> "${tensorflow_file}" | ||||||
| 	done | 	done | ||||||
|  |  | ||||||
| 	local mobilnet_results=$(cat "${tensorflow_file}" | sed 's/.$//') | 	local mobilenet_results=$(cat "${tensorflow_file}" | sed 's/.$//') | ||||||
| 	local average_mobilnet=$(echo "${mobilnet_results}" | sed 's/.$//' | sed "s/,/+/g;s/.*/(&)\/$NUM_CONTAINERS/g" | bc -l) | 	local average_mobilenet=$(echo "${mobilenet_results}" | sed 's/.$//' | sed "s/,/+/g;s/.*/(&)\/$NUM_CONTAINERS/g" | bc -l) | ||||||
| 	local json="$(cat << EOF | 	local json="$(cat << EOF | ||||||
| 	{ | 	{ | ||||||
| 		"Mobilnet": { | 		"Mobilenet": { | ||||||
| 			"Result": "${mobilnet_results}", | 			"Result": "${mobilenet_results}", | ||||||
| 			"Average": "${average_mobilnet}", | 			"Average": "${average_mobilenet}", | ||||||
| 			"Units": "images/s" | 			"Units": "images/s" | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -11,11 +11,11 @@ ENV DEBIAN_FRONTEND=noninteractive | |||||||
| LABEL DOCKERFILE_VERSION="1.0" | LABEL DOCKERFILE_VERSION="1.0" | ||||||
|  |  | ||||||
| RUN apt-get update && \ | RUN apt-get update && \ | ||||||
| 	apt-get install -y --no-install-recommends wget nano curl build-essential git && \ | 	apt-get install -y wget nano curl build-essential git && \ | ||||||
| 	apt-get install -y python3.8  python3-pip && \ | 	apt-get install -y python3.8  python3-pip && \ | ||||||
| 	pip install intel-tensorflow-avx512==2.8.0 && \ | 	pip install --no-cache-dir intel-tensorflow-avx512==2.8.0 && \ | ||||||
| 	pip install protobuf==3.20.* && \ | 	pip install --no-cache-dir protobuf==3.20.* && \ | ||||||
| 	wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v1_8/mobilenet_v1_1.0_224_frozen.pb && \ | 	wget -q https://storage.googleapis.com/intel-optimized-tensorflow/models/v1_8/mobilenet_v1_1.0_224_frozen.pb && \ | ||||||
| 	git clone https://github.com/IntelAI/models.git | 	git clone https://github.com/IntelAI/models.git | ||||||
|  |  | ||||||
| CMD ["/bin/bash"] | CMD ["/bin/bash"] | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user