From 160eddddc4e265d5ee59a38797c30720bf46cd7c Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Sun, 27 May 2018 13:53:42 +0000
Subject: [PATCH] Minor fix
---
src/classifier.c | 51 +++++++++++++++++++++++++++++++++------------------
1 files changed, 33 insertions(+), 18 deletions(-)
diff --git a/src/classifier.c b/src/classifier.c
index d42a917..98dd4c6 100644
--- a/src/classifier.c
+++ b/src/classifier.c
@@ -21,6 +21,8 @@
#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)
@@ -87,6 +89,7 @@
args.min = net.min_crop;
args.max = net.max_crop;
+ args.flip = net.flip;
args.angle = net.angle;
args.aspect = net.aspect;
args.exposure = net.exposure;
@@ -193,6 +196,7 @@
args.min = net.min_crop;
args.max = net.max_crop;
+ args.flip = net.flip;
args.angle = net.angle;
args.aspect = net.aspect;
args.exposure = net.exposure;
@@ -594,7 +598,7 @@
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);
}
@@ -675,7 +679,7 @@
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);
}
@@ -858,11 +862,14 @@
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);
@@ -884,7 +891,8 @@
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);
@@ -990,11 +998,14 @@
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);
@@ -1013,7 +1024,8 @@
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");
@@ -1057,7 +1069,7 @@
{
#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);
}
@@ -1068,9 +1080,11 @@
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);
@@ -1090,7 +1104,8 @@
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");
--
Gitblit v1.10.0