def main():
    """Read the configuration and run the network"""

    args = parse_args()

    # Heaps are sized for the j11_v2 network. Changing the network will
    # require updating network_heap_size and param_heap_size
    config_file = '../test/testvecs/config/infer/tidl_config_j11_v2.txt'

    configuration = Configuration()
    configuration.read_from_file(config_file)
    configuration.enable_api_trace = False
    configuration.num_frames = args.num_frames

    # Heap sizes for this network determined using Configuration.showHeapStats
    configuration.param_heap_size = (3 << 20)
    configuration.network_heap_size = (20 << 20)

    num_dsp = Executor.get_num_devices(DeviceType.DSP)
    num_eve = Executor.get_num_devices(DeviceType.EVE)

    if num_dsp == 0 or num_eve == 0:
        print('This example requires EVEs and DSPs.')
        return

    enable_time_stamps("2eo_opt_timestamp.log", 16)
    run(num_eve, num_dsp, configuration)
示例#2
0
def main():
    """Read the configuration and run the network"""

    args = parse_args()

    # Heaps are sized for the j11_v2 network. Changing the network will
    # require updating network_heap_size and param_heap_size
    config_file = '../test/testvecs/config/infer/tidl_config_j11_v2.txt'

    configuration = Configuration()
    configuration.read_from_file(config_file)
    configuration.enable_api_trace = False
    configuration.num_frames = args.num_frames

    num_dsp = Executor.get_num_devices(DeviceType.DSP)
    num_eve = Executor.get_num_devices(DeviceType.EVE)

    if num_dsp == 0 and num_eve == 0:
        print('No TIDL API capable devices available')
        return

    enable_time_stamps("1eo_timestamp.log", 16)
    run(num_eve, num_dsp, configuration)

    return
示例#3
0
def main():
    """Read the configuration and run the network"""
    #logging.basicConfig(level=logging.INFO)

    args = parse_args()

    config_file = '../test/testvecs/config/infer/tidl_config_j11_v2.txt'
    labels_file = '../imagenet/imagenet_objects.json'

    configuration = Configuration()
    configuration.read_from_file(config_file)

    if os.path.isfile(args.input_file):
        configuration.in_data = args.input_file
    else:
        print('Input image {} does not exist'.format(args.input_file))
        return
    print('Input: {}'.format(args.input_file))

    num_eve = Executor.get_num_devices(DeviceType.EVE)
    num_dsp = Executor.get_num_devices(DeviceType.DSP)

    if num_eve == 0 and num_dsp == 0:
        print('No TIDL API capable devices available')
        return

    # use 1 EVE or DSP since input is a single image
    # If input is a stream of images, feel free to use all EVEs and/or DSPs
    if num_eve > 0:
        num_eve = 1
        num_dsp = 0
    else:
        num_dsp = 1

    run(num_eve, num_dsp, configuration, labels_file)

    return
示例#4
0
def main():
    """ Parse arguments, read configuration and run network"""

    parser = argparse.ArgumentParser(
        description='Dump output of each network layer to file.')
    parser.add_argument(
        '-c',
        '--config_file',
        default='../test/testvecs/config/infer/tidl_config_j11_v2.txt',
        help='Path to TIDL config file')

    args = parser.parse_args()

    # Run network for 1 frame since we interested in intermediate layer outputs
    num_frames = 1

    # Read configuration from file
    configuration = Configuration()
    configuration.read_from_file(args.config_file)
    configuration.enable_layer_dump = True
    configuration.num_frames = num_frames

    num_dsp = Executor.get_num_devices(DeviceType.DSP)
    num_eve = Executor.get_num_devices(DeviceType.EVE)

    if num_dsp == 0 and num_eve == 0:
        print('No TIDL API capable devices available')
        return

    if num_eve > 0:
        device_type = DeviceType.EVE
    else:
        device_type = DeviceType.DSP

    # Since we are dumping layer outputs, just run on one device
    run(device_type, 1, configuration)
示例#5
0
def main():
    """Read the configuration and run the network"""

    args = parse_args()

    config_file = '../test/testvecs/config/infer/tidl_config_mnist_lenet.txt'
    labels_file = '../test/testvecs/input/digits10_labels_10x1.y'

    configuration = Configuration()
    configuration.read_from_file(config_file)

    num_eve = Executor.get_num_devices(DeviceType.EVE)
    num_dsp = 0

    if num_eve == 0:
        print('MNIST network currently supported only on EVE')
        return

    run(num_eve, num_dsp, configuration, labels_file)

    return