| | |
| | | #include "opencv2/videoio/videoio_c.h" |
| | | #endif |
| | | image get_image_from_stream(CvCapture *cap); |
| | | image get_image_from_stream_cpp(CvCapture *cap); |
| | | #include "http_stream.h" |
| | | #endif |
| | | |
| | | float *get_regression_values(char **labels, int n) |
| | |
| | | |
| | | void try_classifier(char *datacfg, char *cfgfile, char *weightfile, char *filename, int layer_num) |
| | | { |
| | | network net = parse_network_cfg(cfgfile); |
| | | network net = parse_network_cfg_custom(cfgfile, 1); |
| | | if(weightfile){ |
| | | load_weights(&net, weightfile); |
| | | } |
| | |
| | | |
| | | void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *filename, int top) |
| | | { |
| | | network net = parse_network_cfg(cfgfile); |
| | | network net = parse_network_cfg_custom(cfgfile, 1); |
| | | if(weightfile){ |
| | | load_weights(&net, weightfile); |
| | | } |
| | |
| | | srand(2222222); |
| | | CvCapture * cap; |
| | | |
| | | if(filename){ |
| | | cap = cvCaptureFromFile(filename); |
| | | }else{ |
| | | cap = cvCaptureFromCAM(cam_index); |
| | | } |
| | | if (filename) { |
| | | //cap = cvCaptureFromFile(filename); |
| | | cap = get_capture_video_stream(filename); |
| | | } |
| | | else { |
| | | //cap = cvCaptureFromCAM(cam_index); |
| | | cap = get_capture_webcam(cam_index); |
| | | } |
| | | |
| | | int top = option_find_int(options, "top", 1); |
| | | |
| | |
| | | struct timeval tval_before, tval_after, tval_result; |
| | | gettimeofday(&tval_before, NULL); |
| | | |
| | | image in = get_image_from_stream(cap); |
| | | //image in = get_image_from_stream(cap); |
| | | image in = get_image_from_stream_cpp(cap); |
| | | if(!in.data) break; |
| | | image in_s = resize_image(in, net.w, net.h); |
| | | |
| | |
| | | srand(2222222); |
| | | CvCapture * cap; |
| | | |
| | | if(filename){ |
| | | cap = cvCaptureFromFile(filename); |
| | | }else{ |
| | | cap = cvCaptureFromCAM(cam_index); |
| | | } |
| | | if (filename) { |
| | | //cap = cvCaptureFromFile(filename); |
| | | cap = get_capture_video_stream(filename); |
| | | } |
| | | else { |
| | | //cap = cvCaptureFromCAM(cam_index); |
| | | cap = get_capture_webcam(cam_index); |
| | | } |
| | | |
| | | int top = option_find_int(options, "top", 1); |
| | | |
| | |
| | | struct timeval tval_before, tval_after, tval_result; |
| | | gettimeofday(&tval_before, NULL); |
| | | |
| | | image in = get_image_from_stream(cap); |
| | | //image in = get_image_from_stream(cap); |
| | | image in = get_image_from_stream_cpp(cap); |
| | | image in_s = resize_image(in, net.w, net.h); |
| | | show_image(in, "Threat Detection"); |
| | | |
| | |
| | | { |
| | | #ifdef OPENCV |
| | | printf("Classifier Demo\n"); |
| | | network net = parse_network_cfg(cfgfile); |
| | | network net = parse_network_cfg_custom(cfgfile, 1); |
| | | if(weightfile){ |
| | | load_weights(&net, weightfile); |
| | | } |
| | |
| | | CvCapture * cap; |
| | | |
| | | if(filename){ |
| | | cap = cvCaptureFromFile(filename); |
| | | //cap = cvCaptureFromFile(filename); |
| | | cap = get_capture_video_stream(filename); |
| | | }else{ |
| | | cap = cvCaptureFromCAM(cam_index); |
| | | //cap = cvCaptureFromCAM(cam_index); |
| | | cap = get_capture_webcam(cam_index); |
| | | } |
| | | |
| | | int top = option_find_int(options, "top", 1); |
| | |
| | | struct timeval tval_before, tval_after, tval_result; |
| | | gettimeofday(&tval_before, NULL); |
| | | |
| | | image in = get_image_from_stream(cap); |
| | | //image in = get_image_from_stream(cap); |
| | | image in = get_image_from_stream_cpp(cap); |
| | | image in_s = resize_image(in, net.w, net.h); |
| | | show_image(in, "Classifier"); |
| | | |