本文整理汇总了C++中set_batch_network函数的典型用法代码示例。如果您正苦于以下问题:C++ set_batch_network函数的具体用法?C++ set_batch_network怎么用?C++ set_batch_network使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_batch_network函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: label_classifier
void label_classifier(char *datacfg, char *filename, char *weightfile)
{
int i;
network *net = load_network(filename, weightfile, 0);
set_batch_network(net, 1);
srand(time(0));
list *options = read_data_cfg(datacfg);
char *label_list = option_find_str(options, "names", "data/labels.list");
char *test_list = option_find_str(options, "test", "data/train.list");
int classes = option_find_int(options, "classes", 2);
char **labels = get_labels(label_list);
list *plist = get_paths(test_list);
char **paths = (char **)list_to_array(plist);
int m = plist->size;
free_list(plist);
for(i = 0; i < m; ++i){
image im = load_image_color(paths[i], 0, 0);
image resized = resize_min(im, net->w);
image crop = crop_image(resized, (resized.w - net->w)/2, (resized.h - net->h)/2, net->w, net->h);
float *pred = network_predict(net, crop.data);
if(resized.data != im.data) free_image(resized);
free_image(im);
free_image(crop);
int ind = max_index(pred, classes);
printf("%s\n", labels[ind]);
}
}
开发者ID:ShahImranShovon,项目名称:darknet,代码行数:34,代码来源:classifier.c
示例2: decode_captcha
void decode_captcha(char *cfgfile, char *weightfile)
{
setbuf(stdout, NULL);
srand(time(0));
network net = parse_network_cfg(cfgfile);
set_batch_network(&net, 1);
if(weightfile){
load_weights(&net, weightfile);
}
char filename[256];
while(1){
printf("Enter filename: ");
fgets(filename, 256, stdin);
strtok(filename, "\n");
image im = load_image_color(filename, 300, 57);
scale_image(im, 1./255.);
float *X = im.data;
float *predictions = network_predict(net, X);
image out = float_to_image(300, 57, 1, predictions);
show_image(out, "decoded");
#ifdef OPENCV
cvWaitKey(0);
#endif
free_image(im);
}
}
开发者ID:Nerei,项目名称:darknet,代码行数:26,代码来源:captcha.c
示例3: test_cifar_multi
void test_cifar_multi(char *filename, char *weightfile)
{
network net = parse_network_cfg(filename);
if(weightfile){
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);
srand(time(0));
float avg_acc = 0;
data test = load_cifar10_data("data/cifar/cifar-10-batches-bin/test_batch.bin");
int i;
for(i = 0; i < test.X.rows; ++i){
image im = float_to_image(32, 32, 3, test.X.vals[i]);
float pred[10] = {0};
float *p = network_predict(net, im.data);
axpy_cpu(10, 1, p, 1, pred, 1);
flip_image(im);
p = network_predict(net, im.data);
axpy_cpu(10, 1, p, 1, pred, 1);
int index = max_index(pred, 10);
int class = max_index(test.y.vals[i], 10);
if(index == class) avg_acc += 1;
free_image(im);
printf("%4d: %.2f%%\n", i, 100.*avg_acc/(i+1));
}
}
开发者ID:Darzu,项目名称:darknet,代码行数:31,代码来源:cifar.c
示例4: predict_regressor
void predict_regressor(char *cfgfile, char *weightfile, char *filename)
{
network *net = load_network(cfgfile, weightfile, 0);
set_batch_network(net, 1);
srand(2222222);
clock_t time;
char buff[256];
char *input = buff;
while(1){
if(filename){
strncpy(input, filename, 256);
}else{
printf("Enter Image Path: ");
fflush(stdout);
input = fgets(input, 256, stdin);
if(!input) return;
strtok(input, "\n");
}
image im = load_image_color(input, 0, 0);
image sized = letterbox_image(im, net->w, net->h);
float *X = sized.data;
time=clock();
float *predictions = network_predict(net, X);
printf("Predicted: %f\n", predictions[0]);
printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
free_image(im);
free_image(sized);
if (filename) break;
}
free_network(net);
}
开发者ID:kunle12,项目名称:darknet,代码行数:33,代码来源:regressor.c
示例5: valid_go
void valid_go(char *cfgfile, char *weightfile, int multi)
{
srand(time(0));
char *base = basecfg(cfgfile);
printf("%s\n", base);
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);
printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
float *board = calloc(19*19, sizeof(float));
float *move = calloc(19*19, sizeof(float));
moves m = load_go_moves("/home/pjreddie/backup/go.test");
int N = m.n;
int i;
int correct = 0;
for(i = 0; i <N; ++i){
char *b = m.data[i];
int row = b[0];
int col = b[1];
int truth = col + 19*row;
string_to_board(b+2, board);
predict_move(net, board, move, multi);
int index = max_index(move, 19*19);
if(index == truth) ++correct;
printf("%d Accuracy %f\n", i, (float) correct/(i+1));
}
}
开发者ID:Zumbalamambo,项目名称:darknetFaceID,代码行数:31,代码来源:go.c
示例6: test_dice
void test_dice(char *cfgfile, char *weightfile, char *filename)
{
network * net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(net, weightfile);
}
set_batch_network(net, 1);
srand(2222222);
int i = 0;
char **names = dice_labels;
char buff[256];
char *input = buff;
int indexes[6];
while(1){
if(filename){
strncpy(input, filename, 256);
}else{
printf("Enter Image Path: ");
fflush(stdout);
input = fgets(input, 256, stdin);
if(!input) return;
strtok(input, "\n");
}
image im = load_image_color(input, net->w, net->h);
float *X = im.data;
float *predictions = network_predict(net, X);
top_predictions(net, 6, indexes);
for(i = 0; i < 6; ++i){
int index = indexes[i];
printf("%s: %f\n", names[index], predictions[index]);
}
free_image(im);
if (filename) break;
}
}
开发者ID:kunle12,项目名称:darknet,代码行数:35,代码来源:dice.c
示例7: test_captcha
void test_captcha(char *cfgfile, char *weightfile)
{
setbuf(stdout, NULL);
srand(time(0));
//char *base = basecfg(cfgfile);
//printf("%s\n", base);
network net = parse_network_cfg(cfgfile);
set_batch_network(&net, 1);
if(weightfile){
load_weights(&net, weightfile);
}
char filename[256];
while(1){
//printf("Enter filename: ");
fgets(filename, 256, stdin);
strtok(filename, "\n");
image im = load_image_color(filename, 200, 60);
translate_image(im, -128);
scale_image(im, 1/128.);
float *X = im.data;
float *predictions = network_predict(net, X);
print_letters(predictions, 10);
free_image(im);
}
}
开发者ID:Nerei,项目名称:darknet,代码行数:25,代码来源:captcha.c
示例8: createYoloNetwork
/*
* @param[in]: ctx
*/
void createYoloNetwork(context_param_yolo_t *yoloctx, char* cfgfile, char* weightfile)
{
printf("Create YOLO network\n");
network net = parse_network_cfg(cfgfile);
if (weightfile)
{
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);
detection_layer l = net.layers[net.n - 1];
yoloGrid grid;
grid.grids = l.side;
grid.bbs = l.n;
grid.classes = l.classes;
box *boxes = malloc(l.side * l.side * l.n * sizeof(box));
float **probs = malloc(l.side * l.side * l.n * sizeof(float *));
for (int j = 0; j < l.side * l.side * l.n; j++)
{
probs[j] = malloc(l.classes*sizeof(float *));
}
yoloctx->_net = net;
yoloctx->_grid = grid;
yoloctx->_grid.boxes = boxes;
yoloctx->_grid.probs = probs;
yoloctx->_nwidth = net.w;
yoloctx->_nheight = net.h;
yoloctx->_sqrt = l.sqrt;
yoloctx->_nms = .5f; // non maximal suppression
}
开发者ID:lxgyChen,项目名称:darknet,代码行数:38,代码来源:yolo_.c
示例9: validate_classifier_full
void validate_classifier_full(char *datacfg, char *filename, char *weightfile)
{
int i, j;
network net = parse_network_cfg(filename);
set_batch_network(&net, 1);
if(weightfile){
load_weights(&net, weightfile);
}
srand(time(0));
list *options = read_data_cfg(datacfg);
char *label_list = option_find_str(options, "labels", "data/labels.list");
char *valid_list = option_find_str(options, "valid", "data/train.list");
int classes = option_find_int(options, "classes", 2);
int topk = option_find_int(options, "top", 1);
char **labels = get_labels(label_list);
list *plist = get_paths(valid_list);
char **paths = (char **)list_to_array(plist);
int m = plist->size;
free_list(plist);
float avg_acc = 0;
float avg_topk = 0;
int *indexes = calloc(topk, sizeof(int));
int size = net.w;
for(i = 0; i < m; ++i){
int class = -1;
char *path = paths[i];
for(j = 0; j < classes; ++j){
if(strstr(path, labels[j])){
class = j;
break;
}
}
image im = load_image_color(paths[i], 0, 0);
image resized = resize_min(im, size);
resize_network(&net, resized.w, resized.h);
//show_image(im, "orig");
//show_image(crop, "cropped");
//cvWaitKey(0);
float *pred = network_predict(net, resized.data);
if(net.hierarchy) hierarchy_predictions(pred, net.outputs, net.hierarchy, 1, 1);
free_image(im);
free_image(resized);
top_k(pred, classes, topk, indexes);
if(indexes[0] == class) avg_acc += 1;
for(j = 0; j < topk; ++j){
if(indexes[j] == class) avg_topk += 1;
}
printf("%d: top 1: %f, top %d: %f\n", i, avg_acc/(i+1), topk, avg_topk/(i+1));
}
}
开发者ID:ysolovyov,项目名称:darknet,代码行数:59,代码来源:classifier.c
示例10: test_detector
void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh, float hier_thresh)
{
int show_flag = 1;
list *options = read_data_cfg(datacfg);
char *name_list = option_find_str(options, "names", "data/names.list");
char **names = get_labels(name_list);
image **alphabet = load_alphabet();
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);
srand(2222222);
clock_t time;
char buff[256];
char *input = buff;
int j;
float nms=.4;
while(1){
if(filename){
strncpy(input, filename, 256);
} else {
printf("Enter Image Path: ");
fflush(stdout);
input = fgets(input, 256, stdin);
if(!input) return;
strtok(input, "\n");
}
image im = load_image_color(input,0,0);
image sized = resize_image(im, net.w, net.h);
layer l = net.layers[net.n-1];
box *boxes = calloc(l.w*l.h*l.n, sizeof(box));
float **probs = calloc(l.w*l.h*l.n, sizeof(float *));
for(j = 0; j < l.w*l.h*l.n; ++j) probs[j] = calloc(l.classes + 1, sizeof(float *));
float *X = sized.data;
time=clock();
network_predict(net, X);
printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
get_region_boxes(l, 1, 1, thresh, probs, boxes, 0, 0, hier_thresh);
if (l.softmax_tree && nms) do_nms_obj(boxes, probs, l.w*l.h*l.n, l.classes, nms);
else if (nms) do_nms_sort(boxes, probs, l.w*l.h*l.n, l.classes, nms);
draw_detections(im, l.w*l.h*l.n, thresh, boxes, probs, names, alphabet, l.classes, show_flag);
save_image(im, "predictions");
show_image(im, "predictions");
free_image(im);
free_image(sized);
free(boxes);
free_ptrs((void **)probs, l.w*l.h*l.n);
#ifdef OPENCV
cvWaitKey(0);
cvDestroyAllWindows();
#endif
if (filename) break;
}
}
开发者ID:apollos,项目名称:eyes,代码行数:59,代码来源:detector.c
示例11: letterbox_image
float *network_predict_image(network *net, image im)
{
image imr = letterbox_image(im, net->w, net->h);
set_batch_network(net, 1);
float *p = network_predict(*net, imr.data);
free_image(imr);
return p;
}
开发者ID:NomokoAG,项目名称:darknet,代码行数:8,代码来源:network.c
示例12: inter_dcgan
void inter_dcgan(char *cfgfile, char *weightfile)
{
network *net = load_network(cfgfile, weightfile, 0);
set_batch_network(net, 1);
srand(2222222);
clock_t time;
char buff[256];
char *input = buff;
int i, imlayer = 0;
for (i = 0; i < net->n; ++i) {
if (net->layers[i].out_c == 3) {
imlayer = i;
printf("%d\n", i);
break;
}
}
image start = random_unit_vector_image(net->w, net->h, net->c);
image end = random_unit_vector_image(net->w, net->h, net->c);
image im = make_image(net->w, net->h, net->c);
image orig = copy_image(start);
int c = 0;
int count = 0;
int max_count = 15;
while(1){
++c;
if(count == max_count){
count = 0;
free_image(start);
start = end;
end = random_unit_vector_image(net->w, net->h, net->c);
if(c > 300){
end = orig;
}
if(c>300 + max_count) return;
}
++count;
slerp(start.data, end.data, (float)count / max_count, im.w*im.h*im.c, im.data);
float *X = im.data;
time=clock();
network_predict(net, X);
image out = get_network_image_layer(net, imlayer);
//yuv_to_rgb(out);
normalize_image(out);
printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
//char buff[256];
sprintf(buff, "out%05d", c);
save_image(out, "out");
save_image(out, buff);
show_image(out, "out", 0);
}
}
开发者ID:kunle12,项目名称:darknet,代码行数:57,代码来源:lsd.c
示例13: test_lsd
void test_lsd(char *cfgfile, char *weightfile, char *filename)
{
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);
srand(2222222);
clock_t time;
char buff[256];
char *input = buff;
int i, imlayer = 0;
for (i = 0; i < net.n; ++i) {
if (net.layers[i].out_c == 3) {
imlayer = i;
printf("%d\n", i);
break;
}
}
while(1){
if(filename){
strncpy(input, filename, 256);
}else{
printf("Enter Image Path: ");
fflush(stdout);
input = fgets(input, 256, stdin);
if(!input) return;
strtok(input, "\n");
}
image im = load_image_color(input, 0, 0);
image resized = resize_min(im, net.w);
image crop = crop_image(resized, (resized.w - net.w)/2, (resized.h - net.h)/2, net.w, net.h);
//grayscale_image_3c(crop);
float *X = crop.data;
time=clock();
network_predict(net, X);
image out = get_network_image_layer(net, imlayer);
//yuv_to_rgb(out);
constrain_image(out);
printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
show_image(out, "out");
show_image(crop, "crop");
save_image(out, "out");
#ifdef OPENCV
cvWaitKey(0);
#endif
free_image(im);
free_image(resized);
free_image(crop);
if (filename) break;
}
}
开发者ID:vaiv,项目名称:OpenANPR,代码行数:57,代码来源:lsd.c
示例14: predict_classifier
void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *filename, int top)
{
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);
srand(2222222);
list *options = read_data_cfg(datacfg);
char *name_list = option_find_str(options, "names", 0);
if(!name_list) name_list = option_find_str(options, "labels", "data/labels.list");
if(top == 0) top = option_find_int(options, "top", 1);
int i = 0;
char **names = get_labels(name_list);
clock_t time;
int *indexes = calloc(top, sizeof(int));
char buff[256];
char *input = buff;
while(1){
if(filename){
strncpy(input, filename, 256);
}else{
printf("Enter Image Path: ");
fflush(stdout);
input = fgets(input, 256, stdin);
if(!input) return;
strtok(input, "\n");
}
image im = load_image_color(input, 0, 0);
image r = letterbox_image(im, net.w, net.h);
//resize_network(&net, r.w, r.h);
//printf("%d %d\n", r.w, r.h);
float *X = r.data;
time=clock();
float *predictions = network_predict(net, X);
if(net.hierarchy) hierarchy_predictions(predictions, net.outputs, net.hierarchy, 1, 1);
top_k(predictions, net.outputs, top, indexes);
fprintf(stderr, "%s: Predicted in %f seconds.\n", input, sec(clock()-time));
for(i = 0; i < top; ++i){
int index = indexes[i];
//if(net.hierarchy) printf("%d, %s: %f, parent: %s \n",index, names[index], predictions[index], (net.hierarchy->parent[index] >= 0) ? names[net.hierarchy->parent[index]] : "Root");
//else printf("%s: %f\n",names[index], predictions[index]);
printf("%5.2f%%: %s\n", predictions[index]*100, names[index]);
}
if(r.data != im.data) free_image(r);
free_image(im);
if (filename) break;
}
}
开发者ID:ysolovyov,项目名称:darknet,代码行数:53,代码来源:classifier.c
示例15: demo_regressor
void demo_regressor(char *datacfg, char *cfgfile, char *weightfile, int cam_index, const char *filename)
{
#ifdef OPENCV
printf("Regressor Demo\n");
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);
srand(2222222);
CvCapture * cap;
if(filename){
cap = cvCaptureFromFile(filename);
}else{
cap = cvCaptureFromCAM(cam_index);
}
if(!cap) error("Couldn't connect to webcam.\n");
cvNamedWindow("Regressor", CV_WINDOW_NORMAL);
cvResizeWindow("Regressor", 512, 512);
float fps = 0;
while(1){
struct timeval tval_before, tval_after, tval_result;
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");
float *predictions = network_predict(net, in_s.data);
printf("\033[2J");
printf("\033[1;1H");
printf("\nFPS:%.0f\n",fps);
printf("People: %f\n", predictions[0]);
free_image(in_s);
free_image(in);
cvWaitKey(10);
gettimeofday(&tval_after, NULL);
timersub(&tval_after, &tval_before, &tval_result);
float curr = 1000000.f/((long int)tval_result.tv_usec);
fps = .9*fps + .1*curr;
}
#endif
}
开发者ID:NomokoAG,项目名称:darknet,代码行数:52,代码来源:regressor.c
示例16: test_yolo
void test_yolo(char *cfgfile, char *weightfile, char *filename, float thresh)
{
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
detection_layer l = net.layers[net.n-1];
set_batch_network(&net, 1);
srand(2222222);
clock_t time;
char buff[256];
char *input = buff;
int j;
float nms=.5;
box *boxes = calloc(l.side*l.side*l.n, sizeof(box));
float **probs = calloc(l.side*l.side*l.n, sizeof(float *));
for(j = 0; j < l.side*l.side*l.n; ++j) probs[j] = calloc(l.classes, sizeof(float *));
while(1){
if(filename){
strncpy(input, filename, 256);
} else {
printf("Enter Image Path: ");
fflush(stdout);
input = fgets(input, 256, stdin);
if(!input) return;
strtok(input, "\n");
}
image im = load_image_color(input,0,0);
image sized = resize_image(im, net.w, net.h);
float *X = sized.data;
time=clock();
float *predictions = network_predict(net, X);
printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
convert_yolo_detections(predictions, l.classes, l.n, l.sqrt, l.side, 1, 1, thresh, probs, boxes, 0);
if (nms) do_nms_sort(boxes, probs, l.side*l.side*l.n, l.classes, nms);
//draw_detections(im, l.side*l.side*l.n, thresh, boxes, probs, voc_names, voc_labels, 20);
draw_detections(im, l.side*l.side*l.n, thresh, boxes, probs, voc_names, 0, 20);
show_image(im, "predictions");
save_image(im, "predictions");
show_image(sized, "resized");
free_image(im);
free_image(sized);
#ifdef OPENCV
cvWaitKey(0);
cvDestroyAllWindows();
#endif
if (filename) break;
}
}
开发者ID:simonfojtu,项目名称:darknet,代码行数:51,代码来源:yolo.c
示例17: predict_classifier
void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *filename)
{
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);
srand(2222222);
list *options = read_data_cfg(datacfg);
char *name_list = option_find_str(options, "names", 0);
if(!name_list) name_list = option_find_str(options, "labels", "data/labels.list");
int top = option_find_int(options, "top", 1);
int i = 0;
char **names = get_labels(name_list);
clock_t time;
int *indexes = calloc(top, sizeof(int));
char buff[256];
char *input = buff;
int size = net.w;
while(1){
if(filename){
strncpy(input, filename, 256);
}else{
printf("Enter Image Path: ");
fflush(stdout);
input = fgets(input, 256, stdin);
if(!input) return;
strtok(input, "\n");
}
image im = load_image_color(input, 0, 0);
image r = resize_min(im, size);
resize_network(&net, r.w, r.h);
printf("%d %d\n", r.w, r.h);
float *X = r.data;
time=clock();
float *predictions = network_predict(net, X);
top_predictions(net, top, indexes);
printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
for(i = 0; i < top; ++i){
int index = indexes[i];
printf("%s: %f\n", names[index], predictions[index]);
}
if(r.data != im.data) free_image(r);
free_image(im);
if (filename) break;
}
}
开发者ID:AlessioTonioni,项目名称:darknet,代码行数:51,代码来源:classifier.c
示例18: parse_network_cfg
int Darknet::loadNetwork(const QString &cfg, const QString &weights)
{
priv->net = parse_network_cfg((char *)qPrintable(getAbs(cfg)));
load_weights(&priv->net, (char *)qPrintable(getAbs(weights)));
set_batch_network(&priv->net, 1);
priv->l = priv->net.layers[priv->net.n-1];
priv->boxes = (box *)calloc(priv->l.side*priv->l.side*priv->l.n, sizeof(box));
priv->probs = (float **)calloc(priv->l.side*priv->l.side*priv->l.n, sizeof(float *));
for(int j = 0; j < priv->l.side * priv->l.side * priv->l.n; ++j)
priv->probs[j] = (float *)calloc(priv->l.classes, sizeof(float *));
return 0;
}
开发者ID:yca,项目名称:VideoAI,代码行数:14,代码来源:darknet.cpp
示例19: parse_network_cfg
void ofxDarknet::init( std::string cfgfile, std::string weightfile, std::string nameslist )
{
if (nameslist != "") {
labelsAvailable = true;
}
net = parse_network_cfg( cfgfile.c_str() );
load_weights( &net, weightfile.c_str() );
set_batch_network( &net, 1 );
if (!nameslist.empty()){
names = get_labels( (char *) nameslist.c_str() );
}
// load layer names
int numLayerTypes = 24;
int * counts = new int[ numLayerTypes ];
for (int i=0; i<numLayerTypes; i++) {counts[i] = 0;}
for (int i=0; i<net.n; i++) {
LAYER_TYPE type = net.layers[i].type;
string layerName = "Unknown";
if (type == CONVOLUTIONAL) layerName = "Conv";
else if (type == DECONVOLUTIONAL) layerName = "Deconv";
else if (type == CONNECTED) layerName = "FC";
else if (type == MAXPOOL) layerName = "MaxPool";
else if (type == SOFTMAX) layerName = "Softmax";
else if (type == DETECTION) layerName = "Detect";
else if (type == DROPOUT) layerName = "Dropout";
else if (type == CROP) layerName = "Crop";
else if (type == ROUTE) layerName = "Route";
else if (type == COST) layerName = "Cost";
else if (type == NORMALIZATION) layerName = "Normalize";
else if (type == AVGPOOL) layerName = "AvgPool";
else if (type == LOCAL) layerName = "Local";
else if (type == SHORTCUT) layerName = "Shortcut";
else if (type == ACTIVE) layerName = "Active";
else if (type == RNN) layerName = "RNN";
else if (type == GRU) layerName = "GRU";
else if (type == CRNN) layerName = "CRNN";
else if (type == BATCHNORM) layerName = "Batchnorm";
else if (type == NETWORK) layerName = "Network";
else if (type == XNOR) layerName = "XNOR";
else if (type == REGION) layerName = "Region";
else if (type == REORG) layerName = "Reorg";
else if (type == BLANK) layerName = "Blank";
layerNames.push_back(layerName+" "+ofToString(counts[type]));
counts[type] += 1;
}
delete counts;
loaded = true;
}
开发者ID:hducg,项目名称:ofxDarknet,代码行数:50,代码来源:ofxDarknet.cpp
示例20: darknet_load_network
int darknet_load_network(struct darknet_helper *dnet, const char *cfg, const char *weights)
{
dnet->priv->net = parse_network_cfg((char *)cfg);
load_weights(&dnet->priv->net, (char *)weights);
set_batch_network(&dnet->priv->net, 1);
detection_layer l = dnet->priv->net.layers[dnet->priv->net.n-1];
dnet->priv->boxes = (box *)calloc(l.side*l.side*l.n, sizeof(box));
dnet->priv->probs = (float **)calloc(l.side*l.side*l.n, sizeof(float *));
int j;
for(j = 0; j < l.side * l.side * l.n; ++j)
dnet->priv->probs[j] = (float *)calloc(l.classes, sizeof(float *));
return 0;
}
开发者ID:yca,项目名称:VideoAI,代码行数:15,代码来源:darknet_helper.c
注:本文中的set_batch_network函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论