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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Asynchronous Inference with OpenVINO™\n",
    "This notebook demonstrates how to use the [Async API](https://docs.openvino.ai/2024/openvino-workflow/running-inference/optimize-inference/general-optimizations.html) for asynchronous execution with OpenVINO.\n",
    "\n",
    "OpenVINO Runtime supports inference in either synchronous or asynchronous mode. The key advantage of the Async API is that when a device is busy with inference, the application can perform other tasks in parallel (for example, populating inputs or scheduling other requests) rather than wait for the current inference to complete first.\n",
    "\n",
    "\n",
    "#### Table of contents:\n",
    "\n",
    "- [Imports](#Imports)\n",
    "- [Prepare model and data processing](#Prepare-model-and-data-processing)\n",
    "    - [Download test model](#Download-test-model)\n",
    "    - [Load the model](#Load-the-model)\n",
    "    - [Create functions for data processing](#Create-functions-for-data-processing)\n",
    "    - [Get the test video](#Get-the-test-video)\n",
    "- [How to improve the throughput of video processing](#How-to-improve-the-throughput-of-video-processing)\n",
    "    - [Sync Mode (default)](#Sync-Mode-(default))\n",
    "    - [Test performance in Sync Mode](#Test-performance-in-Sync-Mode)\n",
    "    - [Async Mode](#Async-Mode)\n",
    "    - [Test the performance in Async Mode](#Test-the-performance-in-Async-Mode)\n",
    "    - [Compare the performance](#Compare-the-performance)\n",
    "- [`AsyncInferQueue`](#AsyncInferQueue)\n",
    "    - [Setting Callback](#Setting-Callback)\n",
    "    - [Test the performance with `AsyncInferQueue`](#Test-the-performance-with-AsyncInferQueue)\n",
    "\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Imports\n",
    "[back to top ⬆️](#Table-of-contents:)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
      "Note: you may need to restart the kernel to use updated packages.\n",
      "\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "import platform\n",
    "\n",
    "%pip install -q \"openvino>=2023.1.0\"\n",
    "%pip install -q opencv-python\n",
    "if platform.system() != \"windows\":\n",
    "    %pip install -q \"matplotlib>=3.4\"\n",
    "else:\n",
    "    %pip install -q \"matplotlib>=3.4,<3.7\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2\n",
    "import time\n",
    "import numpy as np\n",
    "import openvino as ov\n",
    "from IPython import display\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Fetch the notebook utils script from the openvino_notebooks repo\n",
    "import requests\n",
    "\n",
    "r = requests.get(\n",
    "    url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
    ")\n",
    "open(\"notebook_utils.py\", \"w\").write(r.text)\n",
    "\n",
    "import notebook_utils as utils"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Prepare model and data processing\n",
    "[back to top ⬆️](#Table-of-contents:)\n",
    "\n",
    "### Download test model\n",
    "[back to top ⬆️](#Table-of-contents:)\n",
    "\n",
    "We use a pre-trained model from OpenVINO's [Open Model Zoo](https://docs.openvino.ai/2024/documentation/legacy-features/model-zoo.html) to start the test. In this case, the model will be executed to detect the person in each frame of the video."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "################|| Downloading person-detection-0202 ||################\n",
      "\n",
      "========== Retrieving model/intel/person-detection-0202/FP16/person-detection-0202.xml from the cache\n",
      "\n",
      "========== Retrieving model/intel/person-detection-0202/FP16/person-detection-0202.bin from the cache\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# directory where model will be downloaded\n",
    "base_model_dir = \"model\"\n",
    "\n",
    "# model name as named in Open Model Zoo\n",
    "model_name = \"person-detection-0202\"\n",
    "precision = \"FP16\"\n",
    "model_path = f\"model/intel/{model_name}/{precision}/{model_name}.xml\"\n",
    "download_command = f\"omz_downloader \" f\"--name {model_name} \" f\"--precision {precision} \" f\"--output_dir {base_model_dir} \" f\"--cache_dir {base_model_dir}\"\n",
    "! $download_command"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Select inference device\n",
    "[back to top ⬆️](#Table-of-contents:)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "c9c9f01fc0014058909e1d61e7bdd56d",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Dropdown(description='Device:', options=('CPU', 'AUTO'), value='CPU')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import ipywidgets as widgets\n",
    "\n",
    "core = ov.Core()\n",
    "device = widgets.Dropdown(\n",
    "    options=core.available_devices + [\"AUTO\"],\n",
    "    value=\"CPU\",\n",
    "    description=\"Device:\",\n",
    "    disabled=False,\n",
    ")\n",
    "\n",
    "device"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Load the model\n",
    "[back to top ⬆️](#Table-of-contents:)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# initialize OpenVINO runtime\n",
    "core = ov.Core()\n",
    "\n",
    "# read the network and corresponding weights from file\n",
    "model = core.read_model(model=model_path)\n",
    "\n",
    "# compile the model for the CPU (you can choose manually CPU, GPU etc.)\n",
    "# or let the engine choose the best available device (AUTO)\n",
    "compiled_model = core.compile_model(model=model, device_name=device.value)\n",
    "\n",
    "# get input node\n",
    "input_layer_ir = model.input(0)\n",
    "N, C, H, W = input_layer_ir.shape\n",
    "shape = (H, W)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Create functions for data processing\n",
    "[back to top ⬆️](#Table-of-contents:)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def preprocess(image):\n",
    "    \"\"\"\n",
    "    Define the preprocess function for input data\n",
    "\n",
    "    :param: image: the orignal input frame\n",
    "    :returns:\n",
    "            resized_image: the image processed\n",
    "    \"\"\"\n",
    "    resized_image = cv2.resize(image, shape)\n",
    "    resized_image = cv2.cvtColor(np.array(resized_image), cv2.COLOR_BGR2RGB)\n",
    "    resized_image = resized_image.transpose((2, 0, 1))\n",
    "    resized_image = np.expand_dims(resized_image, axis=0).astype(np.float32)\n",
    "    return resized_image\n",
    "\n",
    "\n",
    "def postprocess(result, image, fps):\n",
    "    \"\"\"\n",
    "    Define the postprocess function for output data\n",
    "\n",
    "    :param: result: the inference results\n",
    "            image: the orignal input frame\n",
    "            fps: average throughput calculated for each frame\n",
    "    :returns:\n",
    "            image: the image with bounding box and fps message\n",
    "    \"\"\"\n",
    "    detections = result.reshape(-1, 7)\n",
    "    for i, detection in enumerate(detections):\n",
    "        _, image_id, confidence, xmin, ymin, xmax, ymax = detection\n",
    "        if confidence > 0.5:\n",
    "            xmin = int(max((xmin * image.shape[1]), 10))\n",
    "            ymin = int(max((ymin * image.shape[0]), 10))\n",
    "            xmax = int(min((xmax * image.shape[1]), image.shape[1] - 10))\n",
    "            ymax = int(min((ymax * image.shape[0]), image.shape[0] - 10))\n",
    "            cv2.rectangle(image, (xmin, ymin), (xmax, ymax), (0, 255, 0), 2)\n",
    "            cv2.putText(\n",
    "                image,\n",
    "                str(round(fps, 2)) + \" fps\",\n",
    "                (5, 20),\n",
    "                cv2.FONT_HERSHEY_SIMPLEX,\n",
    "                0.7,\n",
    "                (0, 255, 0),\n",
    "                3,\n",
    "            )\n",
    "    return image"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Get the test video\n",
    "[back to top ⬆️](#Table-of-contents:)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "video_path = \"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/video/CEO%20Pat%20Gelsinger%20on%20Leading%20Intel.mp4\""
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## How to improve the throughput of video processing\n",
    "[back to top ⬆️](#Table-of-contents:)\n",
    "\n",
    "Below, we compare the performance of the synchronous and async-based approaches:\n",
    "\n",
    "### Sync Mode (default)\n",
    "[back to top ⬆️](#Table-of-contents:)\n",
    "\n",
    "Let us see how video processing works with the default approach.<br />\n",
    "Using the synchronous approach, the frame is captured with OpenCV and then immediately processed:\n",
    "\n",
    "![drawing](https://user-images.githubusercontent.com/91237924/168452573-d354ea5b-7966-44e5-813d-f9053be4338a.png)\n",
    "\n",
    "```\n",
    "while(true) {\n",
    "// capture frame\n",
    "// populate CURRENT InferRequest\n",
    "// Infer CURRENT InferRequest\n",
    "//this call is synchronous\n",
    "// display CURRENT result\n",
    "}\n",
    "```\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sync_api(source, flip, fps, use_popup, skip_first_frames):\n",
    "    \"\"\"\n",
    "    Define the main function for video processing in sync mode\n",
    "\n",
    "    :param: source: the video path or the ID of your webcam\n",
    "    :returns:\n",
    "            sync_fps: the inference throughput in sync mode\n",
    "    \"\"\"\n",
    "    frame_number = 0\n",
    "    infer_request = compiled_model.create_infer_request()\n",
    "    player = None\n",
    "    try:\n",
    "        # Create a video player\n",
    "        player = utils.VideoPlayer(source, flip=flip, fps=fps, skip_first_frames=skip_first_frames)\n",
    "        # Start capturing\n",
    "        start_time = time.time()\n",
    "        player.start()\n",
    "        if use_popup:\n",
    "            title = \"Press ESC to Exit\"\n",
    "            cv2.namedWindow(title, cv2.WINDOW_GUI_NORMAL | cv2.WINDOW_AUTOSIZE)\n",
    "        while True:\n",
    "            frame = player.next()\n",
    "            if frame is None:\n",
    "                print(\"Source ended\")\n",
    "                break\n",
    "            resized_frame = preprocess(frame)\n",
    "            infer_request.set_tensor(input_layer_ir, ov.Tensor(resized_frame))\n",
    "            # Start the inference request in synchronous mode\n",
    "            infer_request.infer()\n",
    "            res = infer_request.get_output_tensor(0).data\n",
    "            stop_time = time.time()\n",
    "            total_time = stop_time - start_time\n",
    "            frame_number = frame_number + 1\n",
    "            sync_fps = frame_number / total_time\n",
    "            frame = postprocess(res, frame, sync_fps)\n",
    "            # Display the results\n",
    "            if use_popup:\n",
    "                cv2.imshow(title, frame)\n",
    "                key = cv2.waitKey(1)\n",
    "                # escape = 27\n",
    "                if key == 27:\n",
    "                    break\n",
    "            else:\n",
    "                # Encode numpy array to jpg\n",
    "                _, encoded_img = cv2.imencode(\".jpg\", frame, params=[cv2.IMWRITE_JPEG_QUALITY, 90])\n",
    "                # Create IPython image\n",
    "                i = display.Image(data=encoded_img)\n",
    "                # Display the image in this notebook\n",
    "                display.clear_output(wait=True)\n",
    "                display.display(i)\n",
    "    # ctrl-c\n",
    "    except KeyboardInterrupt:\n",
    "        print(\"Interrupted\")\n",
    "    # Any different error\n",
    "    except RuntimeError as e:\n",
    "        print(e)\n",
    "    finally:\n",
    "        if use_popup:\n",
    "            cv2.destroyAllWindows()\n",
    "        if player is not None:\n",
    "            # stop capturing\n",
    "            player.stop()\n",
    "        return sync_fps"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Test performance in Sync Mode\n",
    "[back to top ⬆️](#Table-of-contents:)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAFoAoADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD8rKKKKsAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9k=",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source ended\n",
      "average throuput in sync mode: 55.59 fps\n"
     ]
    }
   ],
   "source": [
    "sync_fps = sync_api(source=video_path, flip=False, fps=30, use_popup=False, skip_first_frames=800)\n",
    "print(f\"average throuput in sync mode: {sync_fps:.2f} fps\")"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Async Mode\n",
    "[back to top ⬆️](#Table-of-contents:)\n",
    "\n",
    "Let us see how the OpenVINO Async API can improve the overall frame rate of an application. The key advantage of the Async approach is as follows: while a device is busy with the inference, the application can do other things in parallel (for example, populating inputs or scheduling other requests) rather than wait for the current inference to complete first.\n",
    "\n",
    "![drawing](https://user-images.githubusercontent.com/91237924/168452572-c2ff1c59-d470-4b85-b1f6-b6e1dac9540e.png)\n",
    "\n",
    "In the example below, inference is applied to the results of the video decoding. So it is possible to keep multiple infer requests, and while the current request is processed, the input frame for the next is being captured. This essentially hides the latency of capturing, so that the overall frame rate is rather determined only by the slowest part of the pipeline (decoding vs inference) and not by the sum of the stages.\n",
    "\n",
    "```\n",
    "while(true) {\n",
    "// capture frame\n",
    "// populate NEXT InferRequest\n",
    "// start NEXT InferRequest\n",
    "// this call is async and returns immediately\n",
    "// wait for the CURRENT InferRequest\n",
    "// display CURRENT result\n",
    "// swap CURRENT and NEXT InferRequests\n",
    "}\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def async_api(source, flip, fps, use_popup, skip_first_frames):\n",
    "    \"\"\"\n",
    "    Define the main function for video processing in async mode\n",
    "\n",
    "    :param: source: the video path or the ID of your webcam\n",
    "    :returns:\n",
    "            async_fps: the inference throughput in async mode\n",
    "    \"\"\"\n",
    "    frame_number = 0\n",
    "    # Create 2 infer requests\n",
    "    curr_request = compiled_model.create_infer_request()\n",
    "    next_request = compiled_model.create_infer_request()\n",
    "    player = None\n",
    "    async_fps = 0\n",
    "    try:\n",
    "        # Create a video player\n",
    "        player = utils.VideoPlayer(source, flip=flip, fps=fps, skip_first_frames=skip_first_frames)\n",
    "        # Start capturing\n",
    "        start_time = time.time()\n",
    "        player.start()\n",
    "        if use_popup:\n",
    "            title = \"Press ESC to Exit\"\n",
    "            cv2.namedWindow(title, cv2.WINDOW_GUI_NORMAL | cv2.WINDOW_AUTOSIZE)\n",
    "        # Capture CURRENT frame\n",
    "        frame = player.next()\n",
    "        resized_frame = preprocess(frame)\n",
    "        curr_request.set_tensor(input_layer_ir, ov.Tensor(resized_frame))\n",
    "        # Start the CURRENT inference request\n",
    "        curr_request.start_async()\n",
    "        while True:\n",
    "            # Capture NEXT frame\n",
    "            next_frame = player.next()\n",
    "            if next_frame is None:\n",
    "                print(\"Source ended\")\n",
    "                break\n",
    "            resized_frame = preprocess(next_frame)\n",
    "            next_request.set_tensor(input_layer_ir, ov.Tensor(resized_frame))\n",
    "            # Start the NEXT inference request\n",
    "            next_request.start_async()\n",
    "            # Waiting for CURRENT inference result\n",
    "            curr_request.wait()\n",
    "            res = curr_request.get_output_tensor(0).data\n",
    "            stop_time = time.time()\n",
    "            total_time = stop_time - start_time\n",
    "            frame_number = frame_number + 1\n",
    "            async_fps = frame_number / total_time\n",
    "            frame = postprocess(res, frame, async_fps)\n",
    "            # Display the results\n",
    "            if use_popup:\n",
    "                cv2.imshow(title, frame)\n",
    "                key = cv2.waitKey(1)\n",
    "                # escape = 27\n",
    "                if key == 27:\n",
    "                    break\n",
    "            else:\n",
    "                # Encode numpy array to jpg\n",
    "                _, encoded_img = cv2.imencode(\".jpg\", frame, params=[cv2.IMWRITE_JPEG_QUALITY, 90])\n",
    "                # Create IPython image\n",
    "                i = display.Image(data=encoded_img)\n",
    "                # Display the image in this notebook\n",
    "                display.clear_output(wait=True)\n",
    "                display.display(i)\n",
    "            # Swap CURRENT and NEXT frames\n",
    "            frame = next_frame\n",
    "            # Swap CURRENT and NEXT infer requests\n",
    "            curr_request, next_request = next_request, curr_request\n",
    "    # ctrl-c\n",
    "    except KeyboardInterrupt:\n",
    "        print(\"Interrupted\")\n",
    "    # Any different error\n",
    "    except RuntimeError as e:\n",
    "        print(e)\n",
    "    finally:\n",
    "        if use_popup:\n",
    "            cv2.destroyAllWindows()\n",
    "        if player is not None:\n",
    "            # stop capturing\n",
    "            player.stop()\n",
    "        return async_fps"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Test the performance in Async Mode\n",
    "[back to top ⬆️](#Table-of-contents:)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAFoAoADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD8rKKKKsAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9k=",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source ended\n",
      "average throuput in async mode: 75.17 fps\n"
     ]
    }
   ],
   "source": [
    "async_fps = async_api(source=video_path, flip=False, fps=30, use_popup=False, skip_first_frames=800)\n",
    "print(f\"average throuput in async mode: {async_fps:.2f} fps\")"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Compare the performance\n",
    "[back to top ⬆️](#Table-of-contents:)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA9IAAAMPCAYAAAA5M+0vAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8WgzjOAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB2NklEQVR4nOzdZ3hU1f728XtSCCEhCb2TUAIoEJCuCKEooHAERFFQqihYjkI4NJWuAkqxVxAUUUFRigUUpGikNxUpoYTekYQECJCs5wXP7D9DJiF7iGQI3891zaVZa+01vz2ZMLmzdnEYY4wAAAAAAECW+OR0AQAAAAAA3EgI0gAAAAAA2ECQBgAAAADABoI0AAAAAAA2EKQBAAAAALCBIA0AAAAAgA0EaQAAAAAAbCBIAwAAAABgA0EaAAAAAAAbCNIAgFyrSZMmcjgcmjZtWk6XAlwXERERcjgcWrp0aU6XAgC5GkEaAGw4fvy4RowYofr16yssLEz+/v4qWrSoqlWrpoceekjvvPOO9u7dm9Nl4jr75JNP5HA4FBgYqFOnTmVpm8GDB8vhcKhSpUou7RcuXNCHH36ou+++W0WLFlWePHlUoEABVapUSffcc49efvllrVu37prq3bVrl3x8fORwOBQZGXlNcwEAcDPyy+kCAOBGsXLlSrVp00YnTpyQJBUvXlwVKlRQamqqduzYoc2bN2vWrFn6559/9OKLL+ZwtbieHnjgAf33v//V6dOn9eWXX6pPnz6Zjk9NTdX06dMlST169LDajx49qlatWmnDhg2SpNDQUFWpUkV58uTRvn37tGDBAi1YsEBLlizRokWLPK536tSpMsZIknbs2KHly5ercePGHs8HAMDNhhVpAMiCpKQk3X///Tpx4oTq16+v1atX69ChQ1q3bp02btyoxMRErVq1Sv369VOBAgVyulxcZ0FBQerYsaMkZekw8oULF+rgwYPy9fVVt27drPZevXppw4YNKlasmL755hudOHFCf/zxh9auXasjR45ox44dGjdunCpUqOBxrWlpafrkk08kyXqvfvzxxx7PBwDAzYggDQBZ8MMPP+jQoUPy9fXVt99+q7p167r0+/j4qF69epo4caKefvrpHKoSOalnz56SpFWrVmnLli2Zjp06daokqWXLlipZsqQk6fDhw/ruu+8kSW+99Zbat28vX19fl+0qVKiggQMH6oMPPvC4zp9//ln79u1Tvnz59Pbbb0uSvv76a50+fdrjOQEAuNkQpAEgC3bu3ClJKly4sEqUKJHl7b766is5HA6VLVtWaWlpGY4bNmyYHA6HWrdubbUtXbpUDodDERERkqR58+apSZMmCgsLU1BQkOrXr68vv/wy0+c/dOiQBg8erJo1ayokJET58uVTZGSkHn74Yc2fPz/L+xEfHy+HwyGHwyHp0opq8+bNVaBAAYWGhuquu+7S77//bo2Pi4tTt27dVKpUKeXNm1dVq1a9avhbuXKlHnroIZUqVUoBAQEqXLiwWrZsqdmzZ2e63aZNm9S+fXsVKlRI+fLlU/Xq1TV+/HilpqZedb8OHTqkgQMHqlq1agoODlZQUJCioqI0cuRI28HyjjvuUJUqVSRlvip94sQJzZs3T9L/hW9J2r17t3W4dfXq1W09tx3O1ef27durY8eOKlasmJKTkzVz5sxMt5s9e7ZatWqlokWLyt/f3zpvu1OnTvr222+tca+99pocDocaNmyY6Xxdu3aVw+Fw+cPTtGnT5HA41KRJE+vr+vXrKzg4WCEhIWratKl+/vnnTOfdsWOH/vvf/+qWW25RcHCw8ufPrypVquixxx7T8uXLM932clf+/H3++ee6/fbbFRISosKFC6tdu3b6+++/rfHr1q3T/fffr2LFiikwMFC1a9fWN998k+lzLFiwQPfdd5+KFSumPHnyqHjx4mrXrp1++eWXq9bWokULhYWFKX/+/Kpbt26WjyrYsWOHnnrqKVWqVEn58uWztn/99deVkpKSpTkAAJIMAOCq3n77bSPJSDLbt2/P8nbnz583xYoVM5LMDz/84HbMxYsXTenSpY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0J1V/v7+evTRRyX9322uJGn+/Pk6fvy48ubNq86dO2dprvLly+vBBx/U66+/rm3btunll1+WdCno2LkF1vnz5/X5559LunS17CsVLlxY9957ryT395SeMmWKXn31VVWsWFGrVq3SuHHj1K5dOxUtWlQdOnRQfHx8um26deumgIAA/fzzz9q7d6+kS6+l848L/8Z7PiwsLMPtPHW193NWxrh7z2f2vvXz81PhwoVdxl/+3s9oW19fXxUqVChdu/M9n5KSkul7/tixY5Lsv+cB4GZEkAaAbBAaGqqpU6dav+RfGaT9/PysWx1NnjxZ0qVb2MTFxalQoUJWCM8OISEhkqTU1FSXlTBv5FyRTEtL09GjRzMcd+jQIZfxl///kSNHMtzOXZ/zjwsOh0MXL16UuXSaU4aPzG5llRHn93rdunX666+/JP1fqG7fvr1Hgc/X11fPP/+8atWqJSn9eywzc+bM0YkTJyRJzzzzjHUrs8sfc+fOlXTpD0FXfi/8/f01YMAAbd++Xfv27dOXX36p3r17K3/+/Prmm2901113pXuvFSpUSA888IDS0tKscD5r1iwlJiaqWrVqatCgge3XICPO9/ypU6eybc5/S1betxcvXtTx48ddxl/+3s9o29TUVOv7fDnne75s2bJXfb8bYzRixAiP9g0AbiYEaQDIJqGhodbhzefPn0/X//jjj8vHx0dfffWVEhMTrUDdpUsXBQQEZFsdlSpVUt68eSXJ5d7O3qhixYrWoajOwHmlf/75RwcOHJAk3XLLLVa78/Dky+/le7mEhARrVflylSpVUkBAgIwxGT7ntapatarq1asn6VKAPnz4sBYsWCDJ9d7RnoiMjJTk/j2WEWeQDQoKUrFixTJ8+Pv768KFC5o+fXqGc5UuXVoPPfSQ3n//ff35558KCQnRzp07tXDhwnRjnac0TJ06VWlpadZ7vlevXlmuPSuioqIkXbpH9/bt27N17uzmfN+ePXvWuj/9lf7++2/rlAfnez40NFTFixe3+t3Ztm2bLl68mK7deV/y/fv36+TJk9e2AwAASQRpAMiS48ePKy0tLdMx27Zts1by3J2nGR4erpYtW+rMmTN65513NHv2bEmZH+LqiYCAALVp00a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ABsIEgDAAAAAGADQRoAAAAAABsI0gAAAAAA2ODVQfrbb7/V3XffrUKFCilv3rwqV66cOnXqpH379rmMS0xMVExMjMLDwxUQEKCIiAgNGDBASUlJOVQ5AAAAACC38svpAtwxxqhPnz768MMPVaFCBT388MPKnz+/Dh48qGXLlmnPnj0qU6aMJCk5OVnR0dHauHGjWrRooU6dOmnDhg0aP368li1bpuXLlytv3rw5vEcAAAAAgNzCK4P0m2++qQ8//FBPPfWU3nzzTfn6+rr0X7x40fr/V199VRs3btSgQYM0duxYq33w4MEaN26cJk2apCFDhly32gEAAAAAuZvDGGNyuojLnT17VqVKlVKBAgW0bds2+fllnPWNMSpdurQSExN1+PBhBQUFWX3JyckqXry4ihYtqp07d2b5+RMTExUaGqqEhASFhIRc074AAHAjihj8fU6XAADIheLHts7pEjJlJwt63Yr0Tz/9pH/++Uc9evRQamqq5s2bp+3btyssLEx33XWXKlasaI2Ni4vTwYMH1bJlS5cQLUlBQUFq2LChFi5cqH379lmHggMAAAAAcC28LkivW7dOkuTr66uoqCht377d6vPx8VG/fv00fvx4SZeCtCRFRka6nSsyMlILFy5UXFxchkE6JSVFKSkp1teJiYnZsh8AAAAAgNzJ667affToUUnSxIkTFRoaqtWrV+v06dNavny5KlWqpAkTJui9996TJCUkJEiSQkND3c7lXI53jnNnzJgxCg0NtR6sXAMAAAAAMuN1QTotLU2SlCdPHs2ZM0d169ZVcHCwGjVqpK+++ko+Pj6aMGFCtj3fkCFDlJCQYD2uvLUWAAAAAACX87pDu52ry3Xq1FHJkiVd+qpVq6by5ctrx44dOnXqlDU2oxVn52HaGa1YS1JAQIACAgKyo3QAAAAAwE3A61akK1euLEkKCwtz2+9sP3v2rHVutPNc6Std7RxqAAAAAADs8roV6aZNm0qStmzZkq7vwoUL2rFjh4KCglSkSBEVL15cJUuWVGxsrJKTk9Pd/io2NlblypXjvGcAAAAAQLbxuhXpChUqqEWLFtqxY4cmT57s0jd27FidOnVK7du3l5+fnxwOh3r16qWkpCSNHj3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IAAAAA4A08CtIjRozQ9u3b9eWXX2rt2rV68MEHXfoDAwMVHR2tX375JVuKBAAAAADAW3gUpOfNm6c2bdqoY8eOGY6JiIjQ/v37PS4MAAAAAABv5FGQPnTokG699dZMxwQEBCg5OdmjogAAAAAA8FYeBelChQpd9SrdW7duVYkSJTwqCgAAAAAAb+VRkG7cuLHmzp2b4aHbf//9txYsWKC77rrrmooDAAAAAMDbeBSkX3jhBaWmpqphw4aaMWOGjh8/LknasmWLpkyZombNmikgIEADBgzI1mIBAAAAAMhpfp5sVL16dc2cOVNdunRR165dJUnGGFWrVk3GGOXPn1+zZs1SZGRkthYLAAAAAEBO8yhIS9J9992n3bt365NPPtGqVat08uRJhYSEqH79+urRo4cKFy6cnXUCAAAAAOAVPA7SklSwYEH169cvu2oBAAAAAMDreXSOdEaMMYqLi7vqFb0BAAAAALhReRSkv/nmG3Xt2lX//POP1RYfH6+oqChVqVJFERERevjhh5WamppthQIAAAAA4A08CtLvvfeeNm7cqAIFClht/fr10+bNm9W0aVNFRUXpq6++0scff5xthQIAAAAA4A08CtJ///236tWrZ319+vRpff/993rooYe0aNEirV69WrfccgtBGgAAAACQ63gUpE+ePKnixYtbX//222+6ePGiOnXqJEny9/fX3XffrZ07d2ZPlQAAAAAAeAmPgnRISIhOnDhhfb1kyRL5+PioUaNGVpu/v7+Sk5OvvUIAAAAAALyIR0G6SpUqmj9/vk6cOKFTp07p888/V+3atV3Omd6zZ4+KFSuWbYUCAAAAAOANPArSzz77rA4ePKjSpUurbNmyOnTokJ588kmXMStXrlSNGjWypUgAAAAAALyFnycbdejQQe+8846mTJkiSXr44YfVvXt3q3/ZsmVKTExUq1atsqVIAAAAAAC8hUdBWpKefPLJdKvQTtHR0S73mAYAAAAAILfw6NBuAAAAAABuVgRpAAAAAABsIEgDAAAAAGADQRoAAAAAABsI0gAAAAAA2ECQBgAAAADABo+CdM+ePTVp0qTsrgUAAAAAAK/nUZD+/PPPdfTo0eyuBQAAAAAAr+dRkK5QoYIO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5U8nJyYqJidHrr7+uKVOmEKQB3PA4tBuAixUrVkiSnn766XQhWpLKlSunKlWqSJLS0tIUHh6e6aF6jRs3lp+fn/bv3y9JmjZtmhwOh6ZNm6affvpJd9xxh/Lly6dChQqpW7duOnHihNt5Nm3apEceeUSlS5dWQECASpQooVatWmn+/PlX3afLz0XesmWL2rRpo7CwMBUoUECdOnXS8ePHrX1v3ry5QkJCVKBAAfXq1UvJyclu55w6darq16+v4OBgBQcHq379+po2bZrbsampqRo3bpwqVqyovHnzqmLFihozZozS0tIyrPno0aPq16+fKlasqICAABUuXFgdOnTQX3/9ddX9BQBvMmXKFPn5+WngwIFq2rSpFi9erD179rgdGxcXpx49eqhcuXIKCAhQwYIFVaNGDfXt21fOG83ceeed8vPz06FDh9zO0bVrVzkcDuvzbOnSpXI4HBoxYoTWrl2ru+++W/nz51doaKjat2+v+Ph4t/Ps2rVLTzzxhFVL0aJF1aRJkwz/rb+S81zkAwcOqHPnzipcuLDy58+v1q1ba9euXZKkLVu2qF27dipYsKDy58+vBx54QEeOHHE73/z589W0aVOFhoYqMDBQNWrU0MSJE3Xx4kW34ydPnqxq1aopb968KlOmjAYOHKhz585lWO/p06c1fPhwVa1aVYGBgQoLC1PLli3122+/ZWl/gZuOAYDLPProo0aSmTlzZpbGjxo1ykgyM2bMSNe3detWI8m0bt3aaps6daqRZNq3b2/y5MljOnToYPr372/q1q1rJJmGDRumm+frr782efLkMf7+/ub+++83Q4YMMY899pipVq2aadu27VVr3L17t5FkGjdubMLCwsxdd91l+vfvb6Kjo63n/PXXX01gYKC57777TP/+/U3t2rWNJNOjR4908/33v/81kkypUqXMs88+a5599llTqlQpI8k8++yz6cb37NnTSDLlypUzMTEx5qmnnjKFCxc2bdq0MZJMt27dXMbv2LHDlC5d2kgyLVq0MP379zddunQx+fLlM0FBQWblypVX3WcA8AabN282ksy9995rjDHmk08+MZLM8OHD0409cOCACQsLM/7+/qZdu3Zm0KBB5plnnjEtW7Y0/v7+5sKFC8YYYz799FMjybz88svp5vjnn39MYGCgqVq1qtW2ZMkSq4bAwEBz7733mv79+5tmzZoZSaZChQrm7NmzLvP8+uuvJiQkxDgcDtOqVSszePBg07t3b1OvXj1Ts2bNLO27JBMVFWUiIiJMgwYNTExMjPXvfvny5c2ff/5pwsLCTPPmzU3//v1NkyZNjCTTtGnTdHNNmDDBSDIFCxY0ffr0Mf379zeRkZFGkmnXrp1JS0tzGe/8bC5WrJh55plnTL9+/UzZsmWt54+OjnYZf+LECVO1alXrM7Fv376mZ8+eplChQsbPz898++23Wdpn4GZCkAbgYu7cuUaSyZ8/v+nfv79ZuHChOX78eIbjDxw4YPz8/EyTJk3S9f3vf/8zksycOXOsNmeQ9vPzM7/99pvVfvHiReuXiBUrVljthw8fNkFBQSYoKMisX78+3XPs27fvqvvkDNKSzOuvv261p6WlmXvvvddIMmFhYS51nj9/3kRFRRk/Pz9z+PBhq33ZsmVGkrnlllvMqVOnrPaTJ0+aSpUqGUlm+fLlVrvzF7gaNWqYpKQkq33//v2mcOHCboP0HXfcYXx9fc2CBQtc2rdt22by589vqlevftV9BgBvEBMTYySZL774whhjzOnTp01QUJApW7asSU1NdRn75ptvpvt32unEiRPW/589e9YULFjQlC9fPl2AfPvtt9PN4fx3WJL58ssvXcZ36dLFpT5jjDl37pwpVaqU8fHxMT/++GO6WrLyuWOMsZ6zX79+Lu1PPvmk9bmT0WfSunXrrPYdO3YYPz8/U7RoUbN3716XOu+8804jyXz66adWe1xcnPHz8zOlSpUyR44csdoTEhJM5cqV3Qbpzp07G0nmo48+cmk/cuSIKVOmjClSpEi6PzYANzuCNIB0JkyYYIKDg61fApx/sX/66afN9u3b041v3769cTgcJi4uzmo7f/68KVq0qClRooS1imDM/wXprl27ppvH2ffmm29abePGjTOSzLBhwzzeH2eQrlChQrpfupwrG+5WAJx/0f/ll1+sNufqsrsV+xkzZhhJpmfPnlZbjx49jCQze/bsdONHjx6dLkivX78+3RyXc/5S+ueff151vwEgJ50/f94UKVLEhISEuIQw55FPCxcudBnvDNIffPDBVefu16+fkWQWLVrk0n7bbbeZgIAAl+DtDNKNGzdON4+zLyYmxmqbOXNmhp9TdkgywcHBJjk52aV9+fLlV/1M+vjjj60252fRuHHj0j1HbGyskWSaNWtmtY0cOdJIMhMmTEg3fvr06emC9LFjx4yvr6/LHJdzfl/mz5+fpf0GbhZcbAxAOjExMXr88ce1YMEC/f7771q7dq1WrVqld955R1OmTNHMmTN13333WeN79+6tb7/9VpMnT9bYsWMlSfPmzdPRo0f1/PPPy88v/T81tWvXTtdWunRpSdKpU6esttWrV0uSWrRocc37FRUVle687xIlSkiSatasmW68s+/gwYNW24YNGyTJ7T04mzZtKknauHGj1bZp0yZJUqNGjdKNd9e2cuVKSdKRI0c0YsSIdP1bt261/lutWrV0/QDgLebOnatjx47pscceU968ea32rl276rPPPtOUKVNc/m3/z3/+oyFDhujpp5/W4sWL1apVK0VHR6t8+fLp5n7iiSc0adIkffTRR2revLkkad26ddqwYYM6d+6sggULptsmJz53IiMjlS9fPpc252dLZp9JWf3cuf3225U3b95r+txZs2aNUlNTlZKS4vZzJy4uTtKlz502bdqk6wduVgRpAG7lz59fDz74oB588EFJUkJCgp5//nm9++67euyxx3TgwAHlyZNH0qVfNsqVK6dPPvlEL730kvz8/DR58mQ5HA499thjbucPCQlJ1+YM3KmpqVZbQkKCJKlUqVLXvE+ZPWdmfRcuXLDaEhMT5ePjoyJFiqQbX6xYMTkcDiUmJlptCQkJ8vHxUeHChd2Ov9LJkyclSd9//72+//77DPclo4ugAYC3mDJliqRLwflyzZs3V6lSpTR37lydPHnSCr0RERFauXKlRowYoR9++EGzZs2SJFWpUkWjRo2yPo+cbdHR0ZozZ45OnDihQoUKafLkyZKkxx9/3G09N/LnjuT+M8PhcKhYsWI6cOCA1easv2jRounGZ/a5Exsbq9jY2Az3hc8dwBVX7QaQJaGhoXr77bcVHh6u48eP688//7T6HA6HnnjiCR0+fFjz58/Xvn379NNPP6l58+ZuVxLsCAsLkySXXxJyUkhIiNLS0nT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lTYWFhOnXqlObOnau2bduqZs2a6eo6efKkGjdurM2bN6thw4bq06ePEhMTNXfuXDVt2lRfffWV2rVrl267Dh06aNOmTWrVqpXCwsJUrlw5uy8vACA3MAAA5HK7d+82kkyFChXM8OHD3T66detmJJnevXu7bOts3717t9W2aNEiI8nUrFnTJCcnW+0HDx40xYoVM5JMt27dXOYJDw83kkzbtm1NSkpKurlatmzpMv755583kszQoUNNWlqa1Z6YmGjq1Klj8uTJYw4cOJCuztKlS5s9e/bYfm0ur3fevHlGkunbt2+68adPnzbnzp276rxTp041kowks2DBApe+wYMHG0nmmWeesdrOnz9vIiIiTP78+c369etdxv/666/G19fXtGnTxqVdkomOjs70+adOneq2v3PnzkaS+eijj1zajxw5YsqUKWOKFClizp49a7VHR0db3/MTJ05cbfcBALkcK9IAgJvGzp07NXLkyGue57PPPpMkDRs2TPny5bPaS5Qooeeee07PP/98httOmjRJefLksb5u3ry5wsPDtWbNGqstLS1N7733nipUqKCRI0e6HJKcP39+DRs2TPfdd5+++eabdKvSAwYMUNmyZa95HyUpMDAwXVtwcLCtOe666y61bNnSpe2FF17Q+++/r08//VRvvPGGfHx89N133yk+Pl6jRo3Sbbfd5jL+zjvvVNu2bTVnzhwlJiYqJCTE/s5c5vjx45o5c6aaNWumXr16ufQVLVpUAwYM0LPPPqtFixapTZs2Lv0jR45UwYIFr+n5AQA3PoI0AOCm0bJlSy1YsMBt39KlS9W0adMszbNp0yZJlwLelRo2bJjhdhkdCly6dGmXQ8K3bdumf/75RyVLlnQb/I8dOyZJ2rp1a7q+evXqXX0HrqJx48YqUaKExo4dq02bNqlNmzaKjo7WLbfcku4846tp1KhRurbg4GDVrFlTS5cu1a5du1SxYkWtXLlS0qV9d3fe8eHDh5WWlqbt27erTp06Hu2X05o1a5SamqqUlBS3zxUXFyfp0ut7ZZDOjtcXAHDjI0gDAGBTYmKifHx8VLhw4XR9xYoVy3C7jM4r9vPzU1pamvX1yZMnJUmbN2/W5s2bM5wvOTnZ1vNnVWh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QAAsrC0tKSKigotLi5qZmZGbrdbQ0NDqq+vVzwe/+MTTRaLRXt7e1pYWNDy8rI2Njb08fEhp9Mpj8ejvr4+eb3ev/Q1mRoaGnR/f6+joyNtbm7q/f1dLpdLHR0dCofD8ng8v/1WW1ubenp6ND4+rq2tLeXn56u7u1sTExMqLCzMqK2urlYikdDU1JR2d3d1cnIii8Uil8ulUCikzs7OjPrPv/8HBweKx+NKp9Nyu93y+Xyy2WyKxWKKRCKam5v7mhz4DNI2m02np6eanZ3V2tqaVldXlU6nVVxcrMrKSo2Ojv5ymRwAAJKU88+v5pkAAEBW5ufn1dvbq2g0qv7+/p9uBwAAfAOCNAAAWXh9fZXT6czY4pxMJhUIBPT8/Ky7uzuVlJT8YIcAAOC7MNoNAEAWJicnZRiGampq5HA49Pj4qJ2dHb29vSkSiRCiAQD4HyNIAwCQhcbGRl1dXckwDKVSKVmtVvl8Pg0MDKirq+un2wMAAN+I0W4AAAAAAEzgjjQAAAAAACYQpAEAAAAAMIEgDQAAAACACQRpAAAAAABMIEgDAAAAAGACQRoAAAAAABMI0gAAAAAAmECQBgAAAADABII0AAAAAAAm/AvVjzY+0AT9+gAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 1000x800 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "width = 0.4\n",
    "fontsize = 14\n",
    "\n",
    "plt.rc(\"font\", size=fontsize)\n",
    "fig, ax = plt.subplots(1, 1, figsize=(10, 8))\n",
    "\n",
    "rects1 = ax.bar([0], sync_fps, width, color=\"#557f2d\")\n",
    "rects2 = ax.bar([width], async_fps, width)\n",
    "ax.set_ylabel(\"frames per second\")\n",
    "ax.set_xticks([0, width])\n",
    "ax.set_xticklabels([\"Sync mode\", \"Async mode\"])\n",
    "ax.set_xlabel(\"Higher is better\")\n",
    "\n",
    "fig.suptitle(\"Sync mode VS Async mode\")\n",
    "fig.tight_layout()\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## `AsyncInferQueue`\n",
    "[back to top ⬆️](#Table-of-contents:)\n",
    "\n",
    "Asynchronous mode pipelines can be supported with the [`AsyncInferQueue`](https://docs.openvino.ai/2024/openvino-workflow/running-inference/integrate-openvino-with-your-application/python-api-exclusives.html#asyncinferqueue) wrapper class. This class automatically spawns the pool of `InferRequest` objects (also called “jobs”) and provides synchronization mechanisms to control the flow of the pipeline. It is a simpler way to manage the infer request queue in Asynchronous mode."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Setting Callback\n",
    "[back to top ⬆️](#Table-of-contents:)\n",
    "\n",
    "When `callback` is set, any job that ends inference calls upon the Python function. The `callback` function must have two arguments: one is the request that calls the `callback`, which provides the `InferRequest` API; the other is called “user data”, which provides the possibility of passing runtime values."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "def callback(infer_request, info) -> None:\n",
    "    \"\"\"\n",
    "    Define the callback function for postprocessing\n",
    "\n",
    "    :param: infer_request: the infer_request object\n",
    "            info: a tuple includes original frame and starts time\n",
    "    :returns:\n",
    "            None\n",
    "    \"\"\"\n",
    "    global frame_number\n",
    "    global total_time\n",
    "    global inferqueue_fps\n",
    "    stop_time = time.time()\n",
    "    frame, start_time = info\n",
    "    total_time = stop_time - start_time\n",
    "    frame_number = frame_number + 1\n",
    "    inferqueue_fps = frame_number / total_time\n",
    "\n",
    "    res = infer_request.get_output_tensor(0).data[0]\n",
    "    frame = postprocess(res, frame, inferqueue_fps)\n",
    "    # Encode numpy array to jpg\n",
    "    _, encoded_img = cv2.imencode(\".jpg\", frame, params=[cv2.IMWRITE_JPEG_QUALITY, 90])\n",
    "    # Create IPython image\n",
    "    i = display.Image(data=encoded_img)\n",
    "    # Display the image in this notebook\n",
    "    display.clear_output(wait=True)\n",
    "    display.display(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "def inferqueue(source, flip, fps, skip_first_frames) -> None:\n",
    "    \"\"\"\n",
    "    Define the main function for video processing with async infer queue\n",
    "\n",
    "    :param: source: the video path or the ID of your webcam\n",
    "    :retuns:\n",
    "        None\n",
    "    \"\"\"\n",
    "    # Create infer requests queue\n",
    "    infer_queue = ov.AsyncInferQueue(compiled_model, 2)\n",
    "    infer_queue.set_callback(callback)\n",
    "    player = None\n",
    "    try:\n",
    "        # Create a video player\n",
    "        player = utils.VideoPlayer(source, flip=flip, fps=fps, skip_first_frames=skip_first_frames)\n",
    "        # Start capturing\n",
    "        start_time = time.time()\n",
    "        player.start()\n",
    "        while True:\n",
    "            # Capture frame\n",
    "            frame = player.next()\n",
    "            if frame is None:\n",
    "                print(\"Source ended\")\n",
    "                break\n",
    "            resized_frame = preprocess(frame)\n",
    "            # Start the inference request with async infer queue\n",
    "            infer_queue.start_async({input_layer_ir.any_name: resized_frame}, (frame, start_time))\n",
    "    except KeyboardInterrupt:\n",
    "        print(\"Interrupted\")\n",
    "    # Any different error\n",
    "    except RuntimeError as e:\n",
    "        print(e)\n",
    "    finally:\n",
    "        infer_queue.wait_all()\n",
    "        player.stop()"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Test the performance with `AsyncInferQueue`\n",
    "[back to top ⬆️](#Table-of-contents:)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAFoAoADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD8rKKKKsAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9k=",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "average throughput in async mode with async infer queue: 103.81 fps\n"
     ]
    }
   ],
   "source": [
    "frame_number = 0\n",
    "total_time = 0\n",
    "inferqueue(source=video_path, flip=False, fps=30, skip_first_frames=800)\n",
    "print(f\"average throughput in async mode with async infer queue: {inferqueue_fps:.2f} fps\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  },
  "openvino_notebooks": {
   "imageUrl": "",
   "tags": {
    "categories": [
     "API Overview"
    ],
    "libraries": [],
    "other": [],
    "tasks": [
     "Object Detection"
    ]
   }
  },
  "vscode": {
   "interpreter": {
    "hash": "08af04953a73b86b66cc089a637d3d397b0b73ad05ea59846f770cc21ccdacba"
   }
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {
     "4ecf106c6ed841b8b894f447e66c41ba": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "54393aef1aee4b2a981c7b6ee75ed916": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "c9c9f01fc0014058909e1d61e7bdd56d": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "DropdownModel",
      "state": {
       "_options_labels": [
        "CPU",
        "AUTO"
       ],
       "description": "Device:",
       "index": 0,
       "layout": "IPY_MODEL_54393aef1aee4b2a981c7b6ee75ed916",
       "style": "IPY_MODEL_4ecf106c6ed841b8b894f447e66c41ba"
      }
     }
    },
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}