Search code examples
machine-learningyolodeeplearning4jdarkflow

TinyYolo Deeplearning4j


I am using TinyYolo with deeplearning4j having read through this tutorial http://emaraic.com/blog/yolo-custom-object-detector but I am not quite sure whether I need more configuration to handle 720p images as the images in this example are 416x416. Is there a hard requirement of that? I am just struggling to fully understand some configurations as noted :

private static final int CHANNELS = 3;

private static final int GRID_WIDTH = 13;
private static final int GRID_HEIGHT = 13;
private static final int CLASSES_NUMBER = 1;
private static final int BOXES_NUMBER = 5;
private static final double[][] PRIOR_BOXES = {{1.5, 1.5}, {2, 2}, {3,3}, {3.5, 8}, {4, 9}};//anchors boxes

private static final int BATCH_SIZE = 4;
private static final int EPOCHS = 50;
private static final double LEARNIGN_RATE = 0.0001;
private static final int SEED = 1234;

private static final double LAMDBA_COORD = 1.0;
private static final double LAMDBA_NO_OBJECT = 0.5;

I have used darkflow with my labels and images before and had some strong success. I wanted to use deeplearning4j to have more integration with a java project I have. As I have struggled to import the models I have created that still work successfully with some of the python code I have but seem to have some nuance with exportation.

If someone could shed some light on this, I believe there should be ways to handle 720p images. I believe possibly needing to resize. I know darknet and darkflow performed this action themselves. Also if I do perform resizes, will my label annotation xml files then need changes?

Thanks for any help.


Solution

  • You need to resize your 720p input into tinyolo expected input , dimension 416x416

    resize(rgbaMat, resizedImage, new Size(tinyyolowidth, tinyyoloheight));
    

    Ref: https://github.com/yptheangel/dl4j-android-demo/blob/master/app/src/main/java/com/yptheangel/dl4jandroid/yolo_objdetection/ObjDetection.java