def main(): args = build_argparser().parse_args() full_name = path.basename(args.input) extension = path.splitext(full_name)[1] if '.txt' in extension: with open(args.input) as f: videos = [line.strip() for line in f.read().split('\n')] else: videos = [args.input] if not args.input: raise ValueError('--input option is expected') if args.labels: with open(args.labels) as f: labels = [l.strip() for l in f.read().strip().split('\n')] else: labels = None ie = IECore() if 'MYRIAD' in args.device: myriad_config = {'VPU_HW_STAGES_OPTIMIZATION': 'YES'} ie.set_config(myriad_config, 'MYRIAD') if args.cpu_extension and 'CPU' in args.device: ie.add_extension(args.cpu_extension, 'CPU') decoder_target_device = 'CPU' if args.device != 'CPU': encoder_target_device = args.device else: encoder_target_device = decoder_target_device encoder_xml = args.m_encoder encoder_bin = args.m_encoder.replace('.xml', '.bin') encoder = IEModel(encoder_xml, encoder_bin, ie, encoder_target_device, num_requests=(3 if args.device == 'MYRIAD' else 1)) if args.m_decoder is not None: decoder_xml = args.m_decoder decoder_bin = args.m_decoder.replace('.xml', '.bin') decoder = IEModel(decoder_xml, decoder_bin, ie, decoder_target_device, num_requests=2) decoder_seq_size = decoder.input_size[1] else: decoder = DummyDecoder(num_requests=2) decoder_seq_size = args.decoder_seq_size presenter = monitors.Presenter(args.utilization_monitors, 70) result_presenter = ResultRenderer(no_show=args.no_show, presenter=presenter, labels=labels, label_smoothing_window=args.label_smoothing) run_pipeline(videos, encoder, decoder, result_presenter.render_frame, decoder_seq_size=decoder_seq_size, fps=args.fps) print(presenter.reportMeans())
def main(): args = build_argparser().parse_args() full_name = path.basename(args.input) extension = path.splitext(full_name)[1] if '.txt' in extension: with open(args.input) as f: videos = [line.strip() for line in f.read().split('\n')] else: videos = [args.input] if not args.input: raise ValueError("--input option is expected") if args.labels: with open(args.labels) as f: labels = [l.strip() for l in f.read().strip().split('\n')] else: labels = None ie = IECore() if 'MYRIAD' in args.device: myriad_config = {"VPU_HW_STAGES_OPTIMIZATION": "YES"} ie.set_config(myriad_config, "MYRIAD") if args.cpu_extension and 'CPU' in args.device: ie.add_extension(args.cpu_extension, "CPU") decoder_target_device = "CPU" if args.device != 'CPU': encoder_target_device = args.device else: encoder_target_device = decoder_target_device encoder_xml = args.m_encoder encoder_bin = args.m_encoder.replace(".xml", ".bin") decoder_xml = args.m_decoder decoder_bin = args.m_decoder.replace(".xml", ".bin") encoder = IEModel(encoder_xml, encoder_bin, ie, encoder_target_device, num_requests=(3 if args.device == 'MYRIAD' else 1)) decoder = IEModel(decoder_xml, decoder_bin, ie, decoder_target_device, num_requests=2) video_demo(encoder, decoder, videos, args.fps, labels)
def main(): args = build_argparser().parse_args() if args.labels: with open(args.labels) as f: labels = [line.strip() for line in f] else: labels = None log.info('OpenVINO Inference Engine') log.info('\tbuild: {}'.format(get_version())) core = Core() if 'MYRIAD' in args.device: myriad_config = {'VPU_HW_STAGES_OPTIMIZATION': 'YES'} core.set_config(myriad_config, 'MYRIAD') decoder_target_device = 'CPU' if args.device != 'CPU': encoder_target_device = args.device else: encoder_target_device = decoder_target_device models = [IEModel(args.m_encoder, core, encoder_target_device, model_type='Action Recognition Encoder', num_requests=(3 if args.device == 'MYRIAD' else 1))] if args.architecture_type == 'en-de': if args.m_decoder is None: raise RuntimeError('No decoder for encoder-decoder model type (-m_de) provided') models.append(IEModel(args.m_decoder, core, decoder_target_device, model_type='Action Recognition Decoder', num_requests=2)) seq_size = models[1].input_shape[1] elif args.architecture_type == 'en-mean': models.append(DummyDecoder(num_requests=2)) seq_size = args.decoder_seq_size elif args.architecture_type == 'i3d-rgb': seq_size = models[0].input_shape[1] presenter = monitors.Presenter(args.utilization_monitors, 70) result_presenter = ResultRenderer(no_show=args.no_show, presenter=presenter, output=args.output, limit=args.output_limit, labels=labels, label_smoothing_window=args.label_smoothing) cap = open_images_capture(args.input, args.loop) run_pipeline(cap, args.architecture_type, models, result_presenter.render_frame, args.raw_output_message, seq_size=seq_size, fps=cap.fps()) for rep in presenter.reportMeans(): log.info(rep)
def main(): args = build_argparser().parse_args() if args.video_list: with open(args.video_list) as f: videos = [line.strip() for line in f.read().split('\n')] if args.video: videos = [args.video] if not args.video_list and not args.video: raise ValueError("Either --video or --video_list option is expected") if args.labels: with open(args.labels) as f: labels = [l.strip() for l in f.read().strip().split('\n')] else: labels = None decoder_plugin = create_ie_plugin('CPU', cpu_extension=args.cpu_extension, plugin_dir=args.plugin_dir) if args.device != 'CPU': encoder_plugin = create_ie_plugin(args.device, cpu_extension=args.cpu_extension, plugin_dir=args.plugin_dir) else: encoder_plugin = decoder_plugin encoder_xml = args.encoder encoder_bin = args.encoder.replace(".xml", ".bin") decoder_xml = args.decoder decoder_bin = args.decoder.replace(".xml", ".bin") encoder = IEModel(encoder_xml, encoder_bin, encoder_plugin, num_requests=(3 if args.device == 'MYRIAD' else 1)) decoder = IEModel(decoder_xml, decoder_bin, decoder_plugin, num_requests=2) video_demo(encoder, decoder, videos, args.fps, labels)
def main(): args = build_argparser().parse_args() if args.labels: with open(args.labels) as f: labels = [line.strip() for line in f] else: labels = None ie = IECore() if 'MYRIAD' in args.device: myriad_config = {'VPU_HW_STAGES_OPTIMIZATION': 'YES'} ie.set_config(myriad_config, 'MYRIAD') if args.cpu_extension and 'CPU' in args.device: ie.add_extension(args.cpu_extension, 'CPU') decoder_target_device = 'CPU' if args.device != 'CPU': encoder_target_device = args.device else: encoder_target_device = decoder_target_device encoder_xml = args.m_encoder encoder_bin = args.m_encoder.replace('.xml', '.bin') models = [ IEModel(encoder_xml, encoder_bin, ie, encoder_target_device, num_requests=(3 if args.device == 'MYRIAD' else 1)) ] if args.architecture_type == 'en-de': if args.m_decoder is None: raise RuntimeError( 'No decoder for encoder-decoder model type (-m_de) provided') decoder_xml = args.m_decoder decoder_bin = args.m_decoder.replace('.xml', '.bin') models.append( IEModel(decoder_xml, decoder_bin, ie, decoder_target_device, num_requests=2)) seq_size = models[1].input_size[1] elif args.architecture_type == 'en-mean': models.append(DummyDecoder(num_requests=2)) seq_size = args.decoder_seq_size elif args.architecture_type == 'i3d-rgb': seq_size = models[0].input_size[2] presenter = monitors.Presenter(args.utilization_monitors, 70) result_presenter = ResultRenderer( no_show=args.no_show, presenter=presenter, output=args.output, limit=args.output_limit, labels=labels, label_smoothing_window=args.label_smoothing) cap = open_images_capture(args.input, args.loop) run_pipeline(cap, args.architecture_type, models, result_presenter.render_frame, seq_size=seq_size, fps=cap.fps()) print(presenter.reportMeans())