Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Openvino has 16 cores

Monica__Zhao
Beginner
707 Views

Hello, I learned that openvino has 16 kernels, and I want to know how to make full use of these kernels and how to get the utilization of these kernels.For example, I use openvino to implement the detection algorithm, and I want to use a nerve rod to connect four channels of video to process. Could these cores help me?How to use it?Thank you very much!

0 Kudos
8 Replies
Shubha_R_Intel
Employee
707 Views

Dear Monica,

From where did you learn this ?

I learned that openvino has 16 kernels

As I mentioned in your other post I am not sure what you mean by nerve rods or neural rods.  

Please take a look at some OpenVino documentation (below links). OpenVino does support many object detection and image segmentation applications:

http://docs.openvinotoolkit.org/latest/_docs_Pre_Trained_Models.html

http://docs.openvinotoolkit.org/latest/_docs_IE_DG_Samples_Overview.html

http://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html

Thanks for considering OpenVino. Hope it helps !

Shubha

0 Kudos
Monica__Zhao
Beginner
707 Views

Hello, the neural computing stick I mentioned earlier refers to NCS2. In addition, I have 16 core information in NCS2. See the link https://software.intel.com/zh-cn/articles/performance-optimization-for-inference-using-intel-neural-compute-stick-2-with-openvino.

0 Kudos
Monica__Zhao
Beginner
707 Views

I use an NCS2 to connect four-way video. Does NCS2 support it?

0 Kudos
Shubha_R_Intel
Employee
707 Views

Dear Monica,

I see what you mean. You meant 16 shave-cores on an NCS2. Unfortunately, I can't state with certainty that four-way video would work well on NCS2. I can refer you to the following forum post however, where there is discussion about ncs2 cameras. Many suggestions are given by community members which you may find helpful:

https://software.intel.com/en-us/forums/computer-vision/topic/802104

Thanks for considering OpenVino !

Shubha

 

0 Kudos
Monica__Zhao
Beginner
707 Views

Thank you for your reply. I have another question to ask: Does NCS2 support multiple models running at the same time? Can you provide some relevant information? Thank you very much.

0 Kudos
Shubha_R_Intel
Employee
707 Views

Dear Monica, Zhao,

Indeed you can run a model per shave (equivalent to a "logical core"). So, yes, you may run multiple models on an NCS2 stick.

If you're going to build a 4-way video system, you may have better luck with something like this though:

https://up-board.org/ai-core-x/

Or at least multiple NCS-2 sticks. Yes you can run multiple models on an NCS-2 but obviously performance would be better if you run one model per VPU.

Thanks,

Shubha

0 Kudos
Monica__Zhao
Beginner
707 Views

Hello, thank you very much for your reply.Yes, I want to build a four-way video system, and at the same time target detection of four-way video, and I want to use an NCS2 implementation.As you know, NCS2 is only responsible for inference in this system. Can NCS2 accept four-way requests at the same time?In addition, as mentioned earlier, there are 16 computing cores in the NCS. Are these cores enough to be specified independently? How can I get the utilization of the cores?Looking forward to your reply.

0 Kudos
Monica__Zhao
Beginner
707 Views
from NCS2.yolo.yolov2_only import NcsWorker
import threading
from openvino.inference_engine import IENetwork, IEPlugin
import cv2
import numpy as np


net1 = IENetwork(
        model='/home/model_data/yolov2/FP16_new/yolov2.xml',
        weights='/home/sdu/model_data/yolov2/FP16_new/yolov2.bin')

video_capture01 = "/home/sdu/视频/output02.avi"
video_capture02 = "/home/sdu/视频/output_<VideoCapture 0x7f79007195d0>.avi"
video_capture03 = "/home/sdu/output03.avi"
video_capture04 = "/home/output_<VideoCapture 0x7fc23d680f30>.avi"

plugin = IEPlugin(device="MYRIAD")
# plugin.set_config({"KEY_VPU_FORCE_RESET": "NO"})   #
# lock = threading.Lock()


class myThread(threading.Thread):
    def __init__(self, threadID, name, video_path, window_name, net):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name
        self.video_path = video_path
        self.window_name = window_name
        self.net = net

    def run(self):
        # save_boject=False: 默认不保存检测后的对象
        # lock.acquire()
        video_capture = cv2.VideoCapture(self.video_path)

        detection = NcsWorker(self.net, plugin)

        # cv2.namedWindow(self.window_name, flags=cv2.WINDOW_FREERATIO)
        cur_request_id = 0
        next_request_id = 1
        # lock.release()
        while True:

            try:
                ret, frame = video_capture.read()
                if ret != True:
                    break
                boxs = detection.detect(frame, next_request_id, cur_request_id)
                cur_request_id, next_request_id = next_request_id, cur_request_id
                print('-----------------------box----------------')
                print(boxs)
                for box in boxs:
                    box_xmin = (box[0] - box[2] / 2.0)
                    box_xmax = (box[0] + box[2] / 2.0)
                    box_ymin = (box[1] - box[3] / 2.0)
                    box_ymax = (box[1] + box[3] / 2.0)

                    center_x = box[0]
                    center_y = box[1]
                    cv2.circle(frame, (int(center_x), int(center_y)), 3, (255, 0, 0), 2)

                    cv2.rectangle(frame, (int(box_xmin), int(box_ymin)), (int(box_xmax), int(box_ymax)), (255, 0, 0), 2)

                # cv2.imshow(self.window_name, frame)
                height, width = frame.shape[:2]
                resized_show = cv2.resize(frame, (int(width / 2), int(height / 2)), interpolation=cv2.INTER_CUBIC)
                cv2.imshow(self.window_name, resized_show)
                # cv2.waitKey(0)

                # Press Q to stop!
                if cv2.waitKey(1) & 0xFF == ord('q'):
                    break

            except Exception as e:
                pass
        cv2.destroyAllWindows()


# 创建新线程
thread1 = myThread(1, 'Thread-1', video_capture01, '01', net1)
thread2 = myThread(2, 'Thread-2', video_capture02, '02', net1)
thread3 = myThread(3, 'Thread-3', video_capture03, '03', net1)
thread4 = myThread(4, 'Thread-4', video_capture04, '04', net1)
# 开启线程
thread1.start()
thread2.start()
thread3.start()
# thread4.start()

------------------------------------------------------------------------------------------------

When I executed the above code, there was an error:

[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python3: ../../src/xcb_io.c:179:dequeue_pending_request: 假设 ‘!xcb_xlib_unknown_req_in_deq’ 失败。
 

-----------------------------------------------------------------------------------

Is this because NCS2 uses threads? How should I solve it? I look forward to your reply.

0 Kudos
Reply