Darknet: YoloV2 on Gray Scale Images

Created on 13 Feb 2018  Â·  3Comments  Â·  Source: pjreddie/darknet

How can we use yolov2 for gray scale images? I tried to change the number of channels from 3 to 1, but after starting the training for sometime, it shows segmentation fault. Please tell me in detail.. how could i resolve this issue. I have used tiny-yolo as my model. @pjreddie @lilohuang

Most helpful comment

You may give a try using d.X.cols = h*w; instead of d.X.cols = h*w*3; on src/data.c#L953 and recompiling darknet if all input images are gray-scale image for training. Need an elegant fix to this.

//  https://github.com/pjreddie/darknet/blob/master/src/data.c#L944
data load_data_detection(int n, char **paths, int m, int w, int h, int boxes, int classes, float jitter, float hue, float saturation, float exposure)
{
    char **random_paths = get_random_paths(paths, n, m);
    int i;
    data d = {0};
    d.shallow = 0;

    d.X.rows = n;
    d.X.vals = calloc(d.X.rows, sizeof(float*));
    d.X.cols = h*w; // d.X.cols = h*w*3;

All 3 comments

You may give a try using d.X.cols = h*w; instead of d.X.cols = h*w*3; on src/data.c#L953 and recompiling darknet if all input images are gray-scale image for training. Need an elegant fix to this.

//  https://github.com/pjreddie/darknet/blob/master/src/data.c#L944
data load_data_detection(int n, char **paths, int m, int w, int h, int boxes, int classes, float jitter, float hue, float saturation, float exposure)
{
    char **random_paths = get_random_paths(paths, n, m);
    int i;
    data d = {0};
    d.shallow = 0;

    d.X.rows = n;
    d.X.vals = calloc(d.X.rows, sizeof(float*));
    d.X.cols = h*w; // d.X.cols = h*w*3;

@lilohuang Thanks it Worked....

@sayanmutd : Is the performance using grey images is similar when compared to color images?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kthordarson picture kthordarson  Â·  3Comments

bujingdexin picture bujingdexin  Â·  3Comments

job2003 picture job2003  Â·  3Comments

groot-1313 picture groot-1313  Â·  4Comments

gpsmit picture gpsmit  Â·  3Comments