mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
CARLY RAE JEPSEN IS THE BEST POP ARTIST OF ALL TIME DON'T @ ME
This commit is contained in:
@ -32,6 +32,7 @@ void train_regressor(char *datacfg, char *cfgfile, char *weightfile, int *gpus,
|
||||
|
||||
char *backup_directory = option_find_str(options, "backup", "/backup/");
|
||||
char *train_list = option_find_str(options, "train", "data/train.list");
|
||||
int classes = option_find_int(options, "classes", 1);
|
||||
|
||||
list *plist = get_paths(train_list);
|
||||
char **paths = (char **)list_to_array(plist);
|
||||
@ -43,9 +44,10 @@ void train_regressor(char *datacfg, char *cfgfile, char *weightfile, int *gpus,
|
||||
args.w = net->w;
|
||||
args.h = net->h;
|
||||
args.threads = 32;
|
||||
args.classes = classes;
|
||||
|
||||
args.min = net->min_crop;
|
||||
args.max = net->max_crop;
|
||||
args.min = net->min_ratio*net->w;
|
||||
args.max = net->max_ratio*net->w;
|
||||
args.angle = net->angle;
|
||||
args.aspect = net->aspect;
|
||||
args.exposure = net->exposure;
|
||||
@ -160,6 +162,10 @@ void demo_regressor(char *datacfg, char *cfgfile, char *weightfile, int cam_inde
|
||||
}else{
|
||||
cap = cvCaptureFromCAM(cam_index);
|
||||
}
|
||||
list *options = read_data_cfg(datacfg);
|
||||
int classes = option_find_int(options, "classes", 1);
|
||||
char *name_list = option_find_str(options, "names", 0);
|
||||
char **names = get_labels(name_list);
|
||||
|
||||
if(!cap) error("Couldn't connect to webcam.\n");
|
||||
cvNamedWindow("Regressor", CV_WINDOW_NORMAL);
|
||||
@ -171,19 +177,23 @@ void demo_regressor(char *datacfg, char *cfgfile, char *weightfile, int cam_inde
|
||||
gettimeofday(&tval_before, NULL);
|
||||
|
||||
image in = get_image_from_stream(cap);
|
||||
image in_s = letterbox_image(in, net->w, net->h);
|
||||
show_image(in, "Regressor");
|
||||
image crop = center_crop_image(in, net->w, net->h);
|
||||
grayscale_image_3c(crop);
|
||||
show_image(crop, "Regressor");
|
||||
|
||||
float *predictions = network_predict(net, in_s.data);
|
||||
float *predictions = network_predict(net, crop.data);
|
||||
|
||||
printf("\033[2J");
|
||||
printf("\033[1;1H");
|
||||
printf("\nFPS:%.0f\n",fps);
|
||||
|
||||
printf("People: %f\n", predictions[0]);
|
||||
int i;
|
||||
for(i = 0; i < classes; ++i){
|
||||
printf("%s: %f\n", names[i], predictions[i]);
|
||||
}
|
||||
|
||||
free_image(in_s);
|
||||
free_image(in);
|
||||
free_image(crop);
|
||||
|
||||
cvWaitKey(10);
|
||||
|
||||
|
Reference in New Issue
Block a user