Jump to content

AI Based Object Redaction/Examples/Library Examples: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
Line 3: Line 3:
</noinclude>
</noinclude>


 
<!-----
{{Colored box|background-title-color=#6586B9|title-color=#FFFFFF|title='''Note'''|icon=notice-icon-white.png
{{Colored box|background-title-color=#6586B9|title-color=#FFFFFF|title='''Note'''|icon=notice-icon-white.png
   |title='''Note'''
   |title='''Note'''
Line 9: Line 9:
Please refer to the [http://ridgerun.pages.ridgerun.com/rnd/librrobjectredaction/index.html API Documentation] for detailed documentation.
Please refer to the [http://ridgerun.pages.ridgerun.com/rnd/librrobjectredaction/index.html API Documentation] for detailed documentation.
}}
}}
---->


{{Ambox
|type=notice
|small=left
|issue='''Note''': Please refer to the [http://ridgerun.pages.ridgerun.com/rnd/librrobjectredaction/index.html '''API Documentation'''] for detailed documentation.
|style=width:unset;
}}


In this section will be explained an example for face redaction running on GPU.  
In this section will be explained an example for face redaction running on GPU.  
Line 26: Line 33:


In case the input buffer is not already in GPU memory, we also need to create a CPU backend to allocate the buffer in CPU memory.
In case the input buffer is not already in GPU memory, we also need to create a CPU backend to allocate the buffer in CPU memory.
<source lang=C++>
<syntaxhighlight lang=cpp>
std::shared_ptr<rd::IBackend> cpu_backend = std::make_shared<rd::cpu::Backend>();
std::shared_ptr<rd::IBackend> cpu_backend = std::make_shared<rd::cpu::Backend>();
</source>
</syntaxhighlight>


=== Get algorithm ===
=== Get algorithm ===
The GetAlgorithm method is used to obtain the redaction algorithm to process the input buffer.  
The GetAlgorithm method is used to obtain the redaction algorithm to process the input buffer.  


<source lang=C++>
<syntaxhighlight lang=cpp>
std::shared_ptr<rd::IRedaction> algorithm = backend->GetAlgorithm();
std::shared_ptr<rd::IRedaction> algorithm = backend->GetAlgorithm();
</source>
</syntaxhighlight>


=== Get Model ===
=== Get Model ===
The getModel method is used to obtain the AI model that will be used for the detection of the desired object. In this case: faces.  
The getModel method is used to obtain the AI model that will be used for the detection of the desired object. In this case: faces.  


<source lang=C++>
<syntaxhighlight lang=cpp>
std::shared_ptr<rd::IModel> model = backend->getModel(rd::Model::FACE_DETECTION);
std::shared_ptr<rd::IModel> model = backend->getModel(rd::Model::FACE_DETECTION);
</source>
</syntaxhighlight>


== Buffers ==
== Buffers ==
Line 106: Line 113:
</syntaxhighlight>
</syntaxhighlight>


'''NOTE:''' Since the detection model usually works with a fixed resolution and format, an internal conversion to the resolution and format expected by the model. This is transparent so the user doesn't have to worry about any conversion, however, a convert method is also available in case the user wants to do this conversion before calling the detect method.
{{Ambox
|type=notice
|small=left
|issue='''NOTE:''' Since the detection model usually works with a fixed resolution and format, an internal conversion to the resolution and format expected by the model. This is transparent so the user doesn't have to worry about any conversion, however, a convert method is also available in case the user wants to do this conversion before calling the detect method.
|style=width:unset;
}}


<syntaxhighlight lang=cpp>
<syntaxhighlight lang=cpp>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.