python-3.xtensorflowcomputer-visionopenvino

Run Tensorflow model with Intel Open Vino Model Zoo


I just started learning computer vision(newbie to neutral network)

If I want to make detect whether a human holding an umbrella or not with a pre-trained human model with an intel open vino model,

First, I train umbrella images Second, Convert TensorFlow model to the Intel Open Vino model

Third, I am pretty lost here I am not sure how to run my model with the pre-trained model. For example, what I want at the end is that if a human is holding an umbrella, then (human holding an umbrella with a rectangular box) and if not, it says no human holding umbrella... in a box.


Solution

  • To run your model (Intermediate Representation) with OpenVINO™ toolkit, you must implement OpenVINO™ Runtime inference pipeline in your application with the steps as follows:

    Step 1. Create OpenVINO™ Runtime Core

    import openvino.runtime as ov
    
    core = ov.Core()
    

    Step 2. Compile the Model

    compiled_model = core.compile_model("model.xml", "AUTO")
    

    Step 3. Create an Infer Request

    infer_request = compiled_model.create_infer_request()
    

    Step 4. Set Inputs

    # Create tensor from external memory
    input_tensor = ov.Tensor(array=memory, shared_memory=True)
    
    # Set input tensor for model with one input
    infer_request.set_input_tensor(input_tensor)
    

    Step 5. Start Inference

    infer_request.start_async()
    infer_request.wait()
    

    Step 6. Process the Inference Results

    # Get output tensor for model with one output
    output = infer_request.get_output_tensor()
    output_buffer = output.data
    
    # output_buffer[] - accessing output tensor data