Step 4 – Object detection from image frames

Tiny YOLO extracts the features from each frame as an n-dimensional, dense, numerical multi-channel array. Then each image is split into a smaller number of rectangles (boxes):

public void markObjectWithBoundingBox(Mat file, int imageWidth, int imageHeight, boolean newBoundingBOx,                                      String winName) throws Exception { 
        // parameters matching the pretrained TinyYOLO model        int W = 416; // width of the video frame  
        int H = 416; // Height of the video frame 
        int gW = 13; // Grid width 
        int gH = 13; // Grid Height 
        double dT = 0.5; // Detection threshold         Yolo2OutputLayer outputLayer = (Yolo2OutputLayer) model.getOutputLayer(0); 
        if (newBoundingBOx) { 
            INDArray indArray = prepareImage(file, W, H); 
            INDArray results ...

Get Java Deep Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.