'"basename: missing operand" on docker terminal

I wanted to use the machine learning scripts presented in this link: https://idealo.github.io/image-quality-assessment/. The link for the github repository is https://github.com/idealo/image-quality-assessment. I am using a Windows 10 Home machine with Docker toolbox. I executed the following command provided in the above link in the docker terminal.

bash ./predict \ --docker-image nima-cpu \ --base-model-name MobileNet \ --weights-file $(pwd)/models/MobileNet/weights_mobilenet_technical_0.11.hdf5 \ --image-source $(pwd)/src/tests/test_images/42039.jpg

The above command is expected to generate a numerical prediction value as the output for the input image 42039.jpg by passing it through a trained convolutional network model.

But I am getting the following error,

basename: missing operand
Try 'basename --help' for more information.

The contents of the predict file are as follows:

#!/bin/bash
set -e

# parse arguments
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"

case $key in
    --docker-image)
    DOCKER_IMAGE="$2"
    shift # past argument
    shift # past value
    ;;
    --base-model-name)
    BASE_MODEL_NAME="$2"
    shift # past argument
    shift # past value
    ;;
    --weights-file)
    WEIGHTS_FILE="$2"
    shift # past argument
    shift # past value
    ;;
    --image-source)
    IMAGE_SOURCE="$2"
    shift # past argument
    ;;
    *)    # unknown option
    POSITIONAL+=("$1") # save it in an array for later
    shift # past argument
    ;;
esac
done


BASENAME_IS=`basename $IMAGE_SOURCE`

# run predictions
DOCKER_RUN="docker run
  --entrypoint entrypoints/entrypoint.predict.cpu.sh \
  -v "$IMAGE_SOURCE":/src/$BASENAME_IS
  -v "$WEIGHTS_FILE":/src/weights.hdf5
  $DOCKER_IMAGE $BASE_MODEL_NAME /src/weights.hdf5 /src/$BASENAME_IS"

eval $DOCKER_RUN

Any help would be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source