Fixed for Linux: detection for batch > 1 and 0x0d at command line
| | |
| | | demo_classes = classes; |
| | | demo_thresh = thresh; |
| | | printf("Demo\n"); |
| | | net = parse_network_cfg(cfgfile); |
| | | net = parse_network_cfg_custom(cfgfile, 1); |
| | | if(weightfile){ |
| | | load_weights(&net, weightfile); |
| | | } |
| | |
| | | char **names = get_labels(name_list); |
| | | |
| | | image **alphabet = load_alphabet(); |
| | | network net = parse_network_cfg(cfgfile); |
| | | network net = parse_network_cfg_custom(cfgfile, 1); |
| | | if(weightfile){ |
| | | load_weights(&net, weightfile); |
| | | } |
| | |
| | | while(1){ |
| | | if(filename){ |
| | | strncpy(input, filename, 256); |
| | | if (input[strlen(input) - 1] == 0x0d) input[strlen(input) - 1] = 0; |
| | | } else { |
| | | printf("Enter Image Path: "); |
| | | fflush(stdout); |
| | |
| | | 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); |
| | | if (filename[strlen(filename) - 1] == 0x0d) filename[strlen(filename) - 1] = 0; |
| | | demo(cfg, weights, thresh, cam_index, filename, names, classes, frame_skip, prefix, out_filename); |
| | | } |
| | | } |
| | |
| | | |
| | | network parse_network_cfg(char *filename) |
| | | { |
| | | return parse_network_cfg_custom(filename, 0); |
| | | } |
| | | |
| | | network parse_network_cfg_custom(char *filename, int batch) |
| | | { |
| | | list *sections = read_cfg(filename); |
| | | node *n = sections->front; |
| | | if(!n) error("Config file has no sections"); |
| | |
| | | params.w = net.w; |
| | | params.c = net.c; |
| | | params.inputs = net.inputs; |
| | | if (batch > 0) net.batch = batch; |
| | | params.batch = net.batch; |
| | | params.time_steps = net.time_steps; |
| | | params.net = net; |
| | |
| | | return net; |
| | | } |
| | | |
| | | |
| | | |
| | | list *read_cfg(char *filename) |
| | | { |
| | | FILE *file = fopen(filename, "r"); |
| | |
| | | #include "network.h" |
| | | |
| | | network parse_network_cfg(char *filename); |
| | | network parse_network_cfg_custom(char *filename, int batch); |
| | | void save_network(network net, char *filename); |
| | | void save_weights(network net, char *filename); |
| | | void save_weights_upto(network net, char *filename, int cutoff); |