def handle_args():
    """Reads the commandline args and adjusts initial values of globals values to match

    :return: False if there was an error with the args, or True if args processed ok.
    """
    global number_of_devices, number_of_inferences, model_xml_fullpath, model_bin_fullpath, run_async, \
           time_threads, time_main, num_ncs_devs, threads_per_dev, simultaneous_infer_per_thread, report_interval, \
           image_dir, inference_device

    have_model_xml = False
    have_model_bin = False

    for an_arg in argv:
        lower_arg = str(an_arg).lower()
        if (an_arg == argv[0]):
            continue

        elif (lower_arg == 'help'):
            return False

        elif (lower_arg.startswith('num_devices=') or lower_arg.startswith("nd=")):
            try:
                arg, val = str(an_arg).split('=', 1)
                num_dev_str = val
                number_of_devices = int(num_dev_str)
                if (number_of_devices < 0):
                    print('Error - num_devices argument invalid.  It must be > 0')
                    return False
                print('setting num_devices: ' + str(number_of_devices))
            except:
                print('Error - num_devices argument invalid.  It must be between 1 and number of devices in system')
                return False;
                
        elif (lower_arg.startswith('device=') or lower_arg.startswith("dev=")):
            try:
                arg, val = str(an_arg).split('=', 1)
                dev = val
                inference_device = str(dev)
                print("inference device:", inference_device)
                if (inference_device != "MYRIAD" and inference_device != "CPU" ):
                    print('Error - Device must be CPU or MYRIAD')
                    return False
                print('setting device: ' + str(inference_device))
            except:
                print('Error - Device must be CPU or MYRIAD')
                return False;
                
        elif (lower_arg.startswith('report_interval=') or lower_arg.startswith("ri=")):
            try:
                arg, val = str(an_arg).split('=', 1)
                val_str = val
                report_interval = int(val_str)
                if (report_interval < 0):
                    print('Error - report_interval must be greater than or equal to 0')
                    return False
                print('setting report_interval: ' + str(report_interval))
            except:
                print('Error - report_interval argument invalid.  It must be greater than or equal to zero')
                return False;

        elif (lower_arg.startswith('num_inferences=') or lower_arg.startswith('ni=')):
            try:
                arg, val = str(an_arg).split('=', 1)
                num_infer_str = val
                number_of_inferences = int(num_infer_str)
                if (number_of_inferences < 0):
                    print('Error - num_inferences argument invalid.  It must be > 0')
                    return False
                print('setting num_inferences: ' + str(number_of_inferences))
            except:
                print('Error - num_inferences argument invalid.  It must be between 1 and number of devices in system')
                return False;

        elif (lower_arg.startswith('num_threads_per_device=') or lower_arg.startswith('ntpd=')):
            try:
                arg, val = str(an_arg).split('=', 1)
                val_str = val
                threads_per_dev = int(val_str)
                if (threads_per_dev < 0):
                    print('Error - threads_per_dev argument invalid.  It must be > 0')
                    return False
                print('setting num_threads_per_device: ' + str(threads_per_dev))
            except:
                print('Error - num_threads_per_device argument invalid, it must be a positive integer.')
                return False;

        elif (lower_arg.startswith('num_simultaneous_inferences_per_thread=') or lower_arg.startswith('nsipt=')):
            try:
                arg, val = str(an_arg).split('=', 1)
                val_str = val
                simultaneous_infer_per_thread = int(val_str)
                if (simultaneous_infer_per_thread < 0):
                    print('Error - simultaneous_infer_per_thread argument invalid.  It must be > 0')
                    return False
                print('setting num_simultaneous_inferences_per_thread: ' + str(simultaneous_infer_per_thread))
            except:
                print('Error - num_simultaneous_inferences_per_thread argument invalid, it must be a positive integer.')
                return False;

        elif (lower_arg.startswith('model_xml=') or lower_arg.startswith('mx=')):
            try:
                arg, val = str(an_arg).split('=', 1)
                model_xml_fullpath = val
                if not (os.path.isfile(model_xml_fullpath)):
                    print("Error - Model XML file passed does not exist or isn't a file")
                    return False
                print('setting model_xml: ' + str(model_xml_fullpath))
                have_model_xml = True
            except:
                print('Error with model_xml argument.  It must be a valid model file generated by the OpenVINO Model Optimizer')
                return False;

        elif (lower_arg.startswith('model_bin=') or lower_arg.startswith('mb=')):
            try:
                arg, val = str(an_arg).split('=', 1)
                model_bin_fullpath = val
                if not (os.path.isfile(model_bin_fullpath)):
                    print("Error - Model bin file passed does not exist or isn't a file")
                    return False
                print('setting model_bin: ' + str(model_bin_fullpath))
                have_model_bin = True
            except:
                print('Error with model_bin argument.  It must be a valid model file generated by the OpenVINO Model Optimizer')
                return False;

        elif (lower_arg.startswith('run_async=') or lower_arg.startswith('ra=')) :
            try:
                arg, val = str(an_arg).split('=', 1)
                run_async = (val.lower() == 'true')
                print ('setting run_async: ' + str(run_async))
            except:
                print("Error with run_async argument.  It must be 'True' or 'False' ")
                return False;

        elif (lower_arg.startswith('image_dir=') or lower_arg.startswith('id=')):
            try:
                arg, val = str(an_arg).split('=', 1)
                image_dir = val
                if not (os.path.isdir(image_dir)):
                    print("Error - Image directory passed does not exist or isn't a directory:")
                    print("        passed value: " + image_dir)
                    return False
                print('setting image_dir: ' + str(image_dir))

            except:
                print('Error with model_xml argument.  It must be a valid model file generated by the OpenVINO Model Optimizer')
                return False;

        elif (lower_arg.startswith('time_threads=') or lower_arg.startswith('tt=')) :
            try:
                arg, val = str(an_arg).split('=', 1)
                time_threads = (val.lower() == 'true')
                print ('setting time_threads: ' + str(time_threads))
            except:
                print("Error with time_threads argument.  It must be 'True' or 'False' ")
                return False;

        elif (lower_arg.startswith('time_main=') or lower_arg.startswith('tm=')) :
            try:
                arg, val = str(an_arg).split('=', 1)
                time_main = (val.lower() == 'true')
                print ('setting time_main: ' + str(time_main))
            except:
                print("Error with time_main argument.  It must be 'True' or 'False' ")
                return False;

    if (time_main == False and time_threads == False):
        print("Error - Both time_threads and time_main args were set to false.  One of these must be true. ")
        return False

    if ((have_model_bin and not have_model_xml) or (have_model_xml and not have_model_bin)):
        print("Error - only one of model_bin and model_xml were specified.  You must specify both or neither.")
        return False

    if (run_async == False) and (simultaneous_infer_per_thread != 1):
        print("Warning - If run_async is False then num_simultaneous_inferences_per_thread must be 1.")
        print("Setting num_simultaneous_inferences_per_thread to 1")
        simultaneous_infer_per_thread = 1

    return True
Reads the commandline args and adjusts initial values of globals values to match

    :return: False if there was an error with the args, or True if args processed ok.
    
apps/benchmark_ncs/benchmark_ncs.py