Esempio n. 1
0
void run_yolo(int argc, char **argv)
{
    int i;
    for(i = 0; i < 20; ++i){
        char buff[256];
        sprintf(buff, "data/labels/%s.png", voc_names[i]);
        voc_labels[i] = load_image_color(buff, 0, 0);
    }

    float thresh = find_float_arg(argc, argv, "-thresh", .2);
    int cam_index = find_int_arg(argc, argv, "-c", 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_yolo(cfg, weights, thresh, cam_index, filename);
}
Esempio n. 2
0
void run_yolo(int argc, char **argv)
{
	int dont_show = find_arg(argc, argv, "-dont_show");
	int http_stream_port = find_int_arg(argc, argv, "-http_port", -1);
	char *out_filename = find_char_arg(argc, argv, "-out_filename", 0);
    char *prefix = find_char_arg(argc, argv, "-prefix", 0);
    float thresh = find_float_arg(argc, argv, "-thresh", .2);
	float hier_thresh = find_float_arg(argc, argv, "-hier", .5);
    int cam_index = find_int_arg(argc, argv, "-c", 0);
    int frame_skip = find_int_arg(argc, argv, "-s", 0);
	int ext_output = find_arg(argc, argv, "-ext_output");
    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, hier_thresh, cam_index, filename, voc_names, 20, frame_skip,
		prefix, out_filename, http_stream_port, dont_show, ext_output);
}
Esempio n. 3
0
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);
}
Esempio n. 4
0
void run_yolo(int argc, char **argv)
{
	int i;
	for(i = 0; i < CLASSNUM; ++i){
		char buff[256];
		sprintf(buff, "data/labels/%s.png", voc_names[i]);
		voc_labels[i] = load_image_color(buff, 0, 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);
	int save_video = find_int_arg(argc,argv,"-save",1);
	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")){
		if(argc>5){
			char *train_images_txt = argv[4];
			char *backup_directory = argv[5];
			weights = argv[6];
			train_yolo(cfg, weights, train_images_txt, backup_directory);
		} else {
			fprintf(stderr, "usage: %s %s [train] [cfg] [train_images_txt] [backup_directory] [weights (optional)]\n", argv[0], argv[1]);
			return;
		}
	}
	else if(0==strcmp(argv[2], "valid")){ 
		if(argc>6){
			char *val_images_txt = argv[4];
			char *out_directory = argv[5];
			weights = argv[6];
			validate_yolo(cfg, weights,val_images_txt,out_directory);
		} else {
			fprintf(stderr, "usage: %s %s [valid] [cfg] [val_images_txt] [out_directory] [weights (optional)]\n", argv[0], argv[1]);
			return;
		}
	}
	else if(0==strcmp(argv[2], "recall")){
		if(argc>6){
			char *val_images_txt = argv[4];
			char *out_directory = argv[5];
			weights = argv[6];
			int log = find_int_arg(argc,argv,"-log",0);
			int draw = find_int_arg(argc,argv,"-draw",0);
			validate_yolo_recall(cfg, weights, val_images_txt, out_directory, thresh,log,draw);
		} else {
			fprintf(stderr, "usage: %s %s [recall] [cfg] [val_images_txt] [out_directory] [weights (optional)] [-log (0/1)] [-draw (0/1)]\n", argv[0], argv[1]);
			return;
		}
	}
	else if(0==strcmp(argv[2], "vis_weight")){
		visualize_learned_weights(cfg,weights,filename);
	}
	else if(0==strcmp(argv[2], "demo")) 
		demo(cfg, weights, thresh, cam_index, filename, voc_names, voc_labels, CLASSNUM, frame_skip, save_video);
}