TIEVisionNNet.classifyObject
Declaration
function classifyObject(image: TIEVisionImage; out classID: int32_t; out confidence: Single): bool32; safecall;
Description
Sets the preprocessing input, runs forward pass and returns the top prediction.
The method takes an image as input and returns a class index which represents the top prediction.
If the model contains a SoftMax layer, the confidence will be in the 0.0 - 1.0 range.
If the model does not contain a SoftMax layer, the confidence will vary in range value from model to model.
Returns True on success (i.e. both the input and model are valid).
Parameter | Description |
image | Input image |
classID | Index of top prediction |
confidence | Confidence of top prediction |
Note: The classID will reference an index within the class list supplied with the model
// recognize the object inside TImageEnView1 using a pretrained BLVC GoogLeNet model
var
nnet: TIEVisionNNet;
classId: integer;
confidence: single;
begin
nnet := IEVisionLib.createNNet('bvlc_googlenet.caffemodel', 'bvlc_googlenet.prototxt');
nnet.classifyObject(ImageEnView1.IEBitmap.GetIEVisionImage(), classId, confidence);
ShowMessage(Format('Object index %d (%d%%)', [classId, trunc(confidence * 100)]));
end;