You can specify filename for output video by using -out_filename res.avi
| | |
| | | |
| | | darknet.exe detector demo cfg/combine9k.data yolo9000.cfg yolo9000.weights street4k.mp4 |
| | | darknet.exe detector demo cfg/combine9k.data yolo9000.cfg yolo9000.weights street4k.mp4 -out_filename res.avi |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | darknet.exe detector demo data/coco.data yolo.cfg yolo.weights test.mp4 -i 0 |
| | | darknet.exe detector demo data/coco.data yolo.cfg yolo.weights test.mp4 -i 0 -out_filename res.avi |
| | | |
| | | |
| | | pause |
| | |
| | | darknet.exe detector demo data/voc.data yolo-voc.cfg yolo-voc.weights test.mp4 -i 0 |
| | | darknet.exe detector demo data/voc.data yolo-voc.cfg yolo-voc.weights test.mp4 -i 0 -out_filename res.avi |
| | | |
| | | |
| | | pause |
| | |
| | | # |
| | | # Replace the address below, on shown in the phone application |
| | | |
| | | darknet.exe detector demo data/coco.data yolo.cfg yolo.weights http://192.168.0.80:8080/video?dummy=param.mjpg -i 0 |
| | | darknet.exe detector demo data/coco.data yolo.cfg yolo.weights http://192.168.0.80:8080/video?dummy=param.mjpg -i 0 -out_filename res.avi |
| | | |
| | | |
| | | pause |
| | |
| | | # play video from Web-Camera number 0 |
| | | |
| | | darknet.exe detector demo data/voc.data yolo-voc.cfg yolo-voc.weights -c 0 |
| | | darknet.exe detector demo data/voc.data yolo-voc.cfg yolo-voc.weights -c 0 -out_filename res.avi |
| | | |
| | | |
| | | pause |
| | |
| | | |
| | | void run_coco(int argc, char **argv) |
| | | { |
| | | 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); |
| | | int cam_index = find_int_arg(argc, argv, "-c", 0); |
| | |
| | | else if(0==strcmp(argv[2], "train")) train_coco(cfg, weights); |
| | | else if(0==strcmp(argv[2], "valid")) validate_coco(cfg, weights); |
| | | else if(0==strcmp(argv[2], "recall")) validate_coco_recall(cfg, weights); |
| | | else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, cam_index, filename, coco_classes, 80, frame_skip, prefix); |
| | | else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, cam_index, filename, coco_classes, 80, frame_skip, prefix, out_filename); |
| | | } |
| | |
| | | return (double)time.tv_sec + (double)time.tv_usec * .000001; |
| | | } |
| | | |
| | | void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix) |
| | | void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix, char *out_filename) |
| | | { |
| | | //skip = frame_skip; |
| | | image **alphabet = load_alphabet(); |
| | |
| | | |
| | | if(!prefix){ |
| | | //show_image(disp, "Demo"); |
| | | show_image_cv_ipl(show_img, "Demo"); |
| | | show_image_cv_ipl(show_img, "Demo", out_filename); |
| | | int c = cvWaitKey(1); |
| | | if (c == 10){ |
| | | if(frame_skip == 0) frame_skip = 60; |
| | |
| | | } |
| | | } |
| | | #else |
| | | void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix) |
| | | void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix, char *out_filename) |
| | | { |
| | | fprintf(stderr, "Demo needs OpenCV for webcam images.\n"); |
| | | } |
| | |
| | | #define DEMO |
| | | |
| | | #include "image.h" |
| | | void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix); |
| | | void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix, char *out_filename); |
| | | |
| | | #endif |
| | |
| | | |
| | | void run_detector(int argc, char **argv) |
| | | { |
| | | 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", .24); |
| | | int cam_index = find_int_arg(argc, argv, "-c", 0); |
| | |
| | | int classes = option_find_int(options, "classes", 20); |
| | | char *name_list = option_find_str(options, "names", "data/names.list"); |
| | | char **names = get_labels(name_list); |
| | | demo(cfg, weights, thresh, cam_index, filename, names, classes, frame_skip, prefix); |
| | | demo(cfg, weights, thresh, cam_index, filename, names, classes, frame_skip, prefix, out_filename); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | void show_image_cv_ipl(IplImage *disp, const char *name) |
| | | void show_image_cv_ipl(IplImage *disp, const char *name, const char *out_filename) |
| | | { |
| | | if (disp == NULL) return; |
| | | char buff[256]; |
| | |
| | | ++windows; |
| | | cvShowImage(buff, disp); |
| | | |
| | | |
| | | if(out_filename) |
| | | { |
| | | CvSize size; |
| | | { |
| | |
| | | static CvVideoWriter* output_video = NULL; // cv::VideoWriter output_video; |
| | | if (output_video == NULL) |
| | | { |
| | | const char* output_name = "test_dnn_out.avi"; |
| | | //output_video = cvCreateVideoWriter(output_name, CV_FOURCC('H', '2', '6', '4'), 25, size, 1); |
| | | output_video = cvCreateVideoWriter(output_name, CV_FOURCC('D', 'I', 'V', 'X'), 25, size, 1); |
| | | //output_video = cvCreateVideoWriter(output_name, CV_FOURCC('M', 'J', 'P', 'G'), 25, size, 1); |
| | | //const char* output_name = "test_dnn_out.avi"; |
| | | //output_video = cvCreateVideoWriter(out_filename, CV_FOURCC('H', '2', '6', '4'), 25, size, 1); |
| | | output_video = cvCreateVideoWriter(out_filename, CV_FOURCC('D', 'I', 'V', 'X'), 25, size, 1); |
| | | //output_video = cvCreateVideoWriter(out_filename, CV_FOURCC('M', 'J', 'P', 'G'), 25, size, 1); |
| | | } |
| | | |
| | | cvWriteFrame(output_video, disp); // comment this line to improve FPS !!! |
| | |
| | | |
| | | void run_yolo(int argc, char **argv) |
| | | { |
| | | 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); |
| | | int cam_index = find_int_arg(argc, argv, "-c", 0); |
| | |
| | | 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); |
| | | else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, cam_index, filename, voc_names, 20, frame_skip, prefix, out_filename); |
| | | } |