Segmentation fault (Core dumped)
deepkshikha opened this issue · 17 comments
I am getting This error After running make train. I have created the folder according to as it is described . My Images are in .JPG format and verying size.
Does we Require to change anything in src folder as it is not mentioned here to make a change I am curious since yolo.c took no of class and class name and annotation path If these are needed to change. Or because of that error is occuring
ubuntu@ip-172-30-6-196:~/easy-yolo$ make train
/home/ubuntu/easy-yolo/darknet detector train cfg/easy.data cfg/easy.cfg darknet 19_448.conv.23
easy
layer filters size input output
0 conv 16 3 x 3 / 1 448 x 448 x 3 -> 448 x 448 x 16
1 max 2 x 2 / 2 448 x 448 x 16 -> 224 x 224 x 16
2 conv 32 3 x 3 / 1 224 x 224 x 16 -> 224 x 224 x 32
3 max 2 x 2 / 2 224 x 224 x 32 -> 112 x 112 x 32
4 conv 64 3 x 3 / 1 112 x 112 x 32 -> 112 x 112 x 64
5 max 2 x 2 / 2 112 x 112 x 64 -> 56 x 56 x 64
6 conv 128 3 x 3 / 1 56 x 56 x 64 -> 56 x 56 x 128
7 max 2 x 2 / 2 56 x 56 x 128 -> 28 x 28 x 128
8 conv 256 3 x 3 / 1 28 x 28 x 128 -> 28 x 28 x 256
9 max 2 x 2 / 2 28 x 28 x 256 -> 14 x 14 x 256
10 conv 448 3 x 3 / 1 14 x 14 x 256 -> 14 x 14 x 448
11 max 2 x 2 / 1 14 x 14 x 448 -> 14 x 14 x 448
12 conv 1024 3 x 3 / 1 14 x 14 x 448 -> 14 x 14 x1024
13 conv 1024 3 x 3 / 1 14 x 14 x1024 -> 14 x 14 x1024
14 conv 30 1 x 1 / 1 14 x 14 x1024 -> 14 x 14 x 30
15 detection
Loading weights from darknet19_448.conv.23...Done!
Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005
Resizing
448
Cannot load image "131"
Cannot load image "117"
Cannot load image "1006"
Cannot load image "1037"
Cannot load image "1028"
Cannot load image "1007"
Cannot load image "1069"
Cannot load image "1016"
Couldn't open file: 1006
Couldn't open file: 1037
Couldn't open file: 1007
make: *** [train] Segmentation fault (core dumped)
Please suggest something
@deepkshikha could you check/post your folder layout? It seems that the path in your txt is not correct, as the error complained.
Do I need to any change in the below part of yolo.c
void test_yolo(char cfgfile, char weightfile, char filename, float thresh)
{
image **alphabet = load_alphabet();
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
detection_layer l = net.layers[net.n-1];
set_batch_network(&net, 1);
srand(2222222);
clock_t time;
char buff[256];
char input = buff;
int j;
float nms=.4;
box boxes = calloc(l.sidel.sidel.n, sizeof(box));
float **probs = calloc(l.sidel.sidel.n, sizeof(float ));
for(j = 0; j < l.sidel.sidel.n; ++j) probs[j] = calloc(l.classes, sizeof(float ));
while(1){
if(filename){
strncpy(input, filename, 256);
} else {
printf("Enter Image Path: ");
fflush(stdout);
input = fgets(input, 256, stdin);
if(!input) return;
strtok(input, "\n");
}
image im = load_image_color(input,0,0);
image sized = resize_image(im, net.w, net.h);
float X = sized.data;
time=clock();
network_predict(net, X);
printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
get_detection_boxes(l, 1, 1, thresh, probs, boxes, 0);
if (nms) do_nms_sort(boxes, probs, l.sidel.sidel.n, l.classes, nms);
//draw_detections(im, l.sidel.sidel.n, thresh, boxes, probs, voc_names, alphabet, 20);
draw_detections(im, l.sidel.sidel.n, thresh, boxes, probs, voc_names, alphabet, 20);
save_image(im, "predictions");
show_image(im, "predictions");
free_image(im);
free_image(sized);
#ifdef OPENCV
cvWaitKey(0);
cvDestroyAllWindows();
#endif
if (filename) break;
}
}
void run_yolo(int argc, char **argv)
{
char *prefix = find_char_arg(argc, argv, "-prefix", 0);
float thresh = find_float_arg(argc, argv, "-thresh", .2);
int cam_index = find_int_arg(argc, argv, "-c", 0);
int frame_skip = find_int_arg(argc, argv, "-s", 0);
if(argc < 4){
fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
return;
}
char *cfg = argv[3];
char *weights = (argc > 4) ? argv[4] : 0;
char *filename = (argc > 5) ? argv[5]: 0;
if(0==strcmp(argv[2], "test")) test_yolo(cfg, weights, filename, thresh);
else if(0==strcmp(argv[2], "train")) train_yolo(cfg, weights);
else if(0==strcmp(argv[2], "valid")) validate_yolo(cfg, weights);
else if(0==strcmp(argv[2], "recall")) validate_yolo_recall(cfg, weights);
else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, cam_index, filename, voc_names, 20, frame_skip, prefix, .5);
}
I made the changes only this part of yolo.c
#include "network.h"
#include "detection_layer.h"
#include "cost_layer.h"
#include "utils.h"
#include "parser.h"
#include "box.h"
#include "demo.h"
#ifdef OPENCV
#include "opencv2/highgui/highgui_c.h"
#endif
char *voc_names[] = {"crater"};
void train_yolo(char *cfgfile, char *weightfile)
{
char *train_images = "/home/ubuntu/easy-yolo/devkit/2017/ImageSets/train.txt";
char *backup_directory = "/home/ubuntu/easy-yolo/backup/";
srand(time(0));
char *base = basecfg(cfgfile);
printf("%s\n", base);
float avg_loss = -1;
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
@deepkshikha man, I cannot really know what you have changed by you showing code in this way.
But obviously, your error is throw from here. You can try to add some logs here to see specifically why it failed. Should be fairly easy.
I just changed two lines in yolo.c
the path of training set
char *train_images = "/home/ubuntu/easy-yolo/devkit/2017/ImageSets/train.txt";
char *backup_directory = "/home/ubuntu/easy-yolo/backup/";
Do I need to change anything else in yolo.c ??
Thanks It works There is some error in .txt file
@deepkshikha Neat!
Training is going on But I have a confusion don't we need to change paths in yolo.c ?
@deepkshikha That's just a default path I believe. Eventually, it will load the path from the config/data file
Thanks a lot .What's the expected time for training ? I am using AWS gpu compute instance .
@deepkshikha it's up to how many images you are feeding in.
Is there some resource from where I can read how this is working . That is apart from creating folders in this manner why we created and rest of the things
@deepkshikha
Donno how to recommend then. Read Ian Goodfellow's <> maybe?
Thanks