TIEVisionNNet.detectObjects
Declaration
function detectObjects(image: TIEVisionImage; out classIDs: TIEVisionVectorInt32; out confidences: TIEVisionVectorDouble; out rects: TIEVisionVectorRect): bool32; safecall;
Description
Detects objects in the specified input image and returns their class IDs, confidences, and bounding boxes.
Returns True on success (both input and model valid).
Parameter | Description |
image | Input image |
classIDs | Output array of detected class IDs |
confidences | Output array of confidences per class ID detected |
rects | Output array of boxes per class ID detected |
Note: The classIDs will reference an index withing the class list supplied with the model
// Detects and classify all objects inside TImageEnView using MobileNetSSD pretrained model
var
nnet: TIEVisionNNet;
rects: TIEVisionVectorRect;
classIDs: TIEVisionVectorInt32;
confidences: TIEVisionVectorDouble;
i: integer;
begin
nnet := IEVisionLib.createNNet('MobileNetSSD_deploy.caffemodel', 'MobileNetSSD_deploy.prototxt');
nnet.setInputScale(0.007843);
nnet.detectObjects(ImageEnView1.IEBitmap.GetIEVisionImage(), classIDs, confidences, rects);
for i := 0 to classIDs.size() - 1 do
begin
// do something with detected objects
end
end;