O'Reilly logo

Java Deep Learning Projects by Md. Rezaul Karim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Step 3 – Feeding generated frames into Tiny YOLO model

Now that we know some properties of the clip, we can start generating the frames to be passed to the Tiny YOLO pre-trained model. First, let's look at a less important but transparent approach:

private volatile Mat[] v = new Mat[1]; 
private String windowName = "Object Detection from Video"; 
try { 
    for(int i = 1; i < frameGrabber.getLengthInFrames();     
    i+ = (int)frameRate) { 
                frameGrabber.setFrameNumber(i); 
                frame = frameGrabber.grab(); 
                v[0] = new OpenCVFrameConverter.ToMat().convert(frame); 
                model.markObjectWithBoundingBox(v[0], frame.imageWidth,                                                frame.imageHeight, true, windowName); 
                imshow(windowName, v[0]); 
 
                char key = (char) waitKey(20); 
                // Exit on escape: 
                if (key == 27) { destroyAllWindows(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required