diff --git a/.env b/.env index 29962c5..8a5c66f 100644 --- a/.env +++ b/.env @@ -4,7 +4,10 @@ source .fun if [ -z "${PROCESSOR_TYPE}" ]; then - export PROCESSOR_TYPE=CPU + export PROCESSOR_TYPE=cpu +else + # Always use lowercase + export PROCESSOR_TYPE=${PROCESSOR_TYPE,,} fi # Proxy settings [optional] - set if your network requires a proxy to connect to the Internet @@ -28,7 +31,7 @@ export VERSION=latest export TAG=$(if [ -z "${VERSION}" ]; then echo "${PROCESSOR_TYPE}"; else echo ":${VERSION}${PROCESSOR_TYPE}"; fi) ## BUILD_OPTS: [optional] - arguments for the docker image build command export BUILD_OPTS="--build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} --build-arg no_proxy=${no_proxy}" -if [ "${PROCESSOR_TYPE}" == "GPU" ]; then +if [ "${PROCESSOR_TYPE^^}" == "GPU" ]; then export BUILD_OPTS="${BUILD_OPTS} -f Dockerfile-GPU" fi # Docker container runtime settings @@ -43,7 +46,7 @@ export VOL_MAP="-v $(pwd):/wd" export NETWORK= ## RUN_OPTS [optional] - additional options to specify with the run comman. Example -e POSTGRES_DB=dbname export RUN_OPTS="-e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy" -if [ "${PROCESSOR_TYPE}" == "GPU" ]; then +if [ "${PROCESSOR_TYPE^^}" == "GPU" ]; then export RUN_OPTS="${RUN_OPTS} --runtime=nvidia -e LC_ALL=C.UTF-8 -e LANG=C.UTF-8" fi diff --git a/recognize.sh b/recognize.sh index 1912ca0..285d746 100755 --- a/recognize.sh +++ b/recognize.sh @@ -8,6 +8,21 @@ if [ "${1}" == "--help" ]; then exit 0 fi +echo "" +echo "===========================================" +echo "Processor: ${PROCESSOR_TYPE}" +echo "Face recognition start time:" +date +STARTTIME=$(date +%s) +echo "" + ./run.sh face_recognition /wd/data/known_people /wd/data/images/$1 --show-distance True --tolerance 0.586 --cpus -1 | grep -v None +echo "" +echo "Face recognition end time: " +date +ENDTIME=$(date +%s) +echo "Total elapsed: $(($ENDTIME - $STARTTIME)) seconds" +echo "===========================================" +echo "" diff --git a/run.sh b/run.sh index 2ce6cb3..ad4ffb2 100755 --- a/run.sh +++ b/run.sh @@ -8,5 +8,6 @@ else MODE="-it --rm" fi +echo "docker container run ${RUN_OPTS} ${CONTAINER_NAME} ${MODE} ${NETWORK} ${PORT_MAP} ${VOL_MAP} ${REGISTRY}${IMAGE}${TAG} $@" docker container run ${RUN_OPTS} ${CONTAINER_NAME} ${MODE} ${NETWORK} ${PORT_MAP} ${VOL_MAP} ${REGISTRY}${IMAGE}${TAG} $@