static bool do_mount(const char *mountpoint) { const char *source_path; bool is_image; if (!get_paths(mountpoint, &source_path, &is_image)) { LOGE(TAG "%s: Invalid mountpoint", mountpoint); return false; } const char *fstype; unsigned long flags; if (is_image) { fstype = "ext4"; flags = MS_NOATIME; } else { fstype = ""; flags = MS_BIND; } // NOTE: We don't need the loop mount logic in util::mount() if (mount(source_path, mountpoint, fstype, flags, "") < 0) { LOGE(TAG "%s: Failed to mount path: %s", source_path, strerror(errno)); return false; } LOGD(TAG "Successfully mounted %s at %s", source_path, mountpoint); return true; }
void show_help() { const paths my_paths = get_paths(); printf( "Usage\n" "=====\n" " -h --help\n" " Shows this info.\n" " -t --toggle\n" " Toggle switch mode by two keys (first switching on, second switching off)\n" " -m --modifier\n" " Modifier key mode, when pressed then switching on, and switching off when released.\n" "-----\n" "Create this bash scripts with on/off actions:\n" " On: %s\n" " Off: %s\n" "-----\n" "Create this files with numbers of keys to on/off:\n" " On: %s\n" " Off (only for --toggle mode): %s\n", my_paths.on_bin, my_paths.off_bin, my_paths.on_key_cfg, my_paths.off_key_cfg ); }
int main(UNUSED int ac, UNUSED char **av, char **env) { t_main s; int *jobs; if ((jobs = malloc(1 * sizeof(int))) == NULL) return (-1); jobs[0] = -1; jobs = update_jobs(jobs, 1); init_env(env, &s.my_env); init_history(&s.cmd, &s.history, &s.term, &s.stop); while (!s.stop && get_return_value(0, 0, 0, 0) == 0 && update_fils(0, -1) != -1) { save_pid(2, 0); get_signal(); if ((s.paths = get_paths()) != NULL) end_main(&s); is_too_much(0); } end_shell(s.history, s.term); save_pid(2, 0); close_fg(jobs, 0); return (get_return_value(0, 0, 0, 1)); }
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]); } }
int exec(t_struc *s, char **env) { int i; char *temp; char **paths; paths = get_paths(s); i = 0; while (paths[i]) { temp = ft_strjoin(paths[i], s->cmd); if ((access(temp, F_OK) == 0) && (access(temp, X_OK) == -1)) { ft_putendl_fd(ft_strjoin("\033[33;31m-> Error:\033[33;0m ", ft_strjoin(s->cmd, ": Permission denied. ")), 2); return (0); } execve(temp, s->argv, env); free(temp); i++; } ft_putendl_fd(ft_strjoin("\033[33;31m-> Error:\033[33;0m ", ft_strjoin(s->cmd, ": Command not found. ")), 2); return (0); }
void main(int argc, char *argv[]) { int i; if (argc != 1) { printf ("Sorry, i don't take command line arguments.\n"); exit(-1); } else { t_node n; // well heluuu there :) init(); get_distances(); n = (t_node)malloc(sizeof(struct s_node)); n->path =(int *)malloc (d * sizeof (int)); n->path[1] = 1; n->level = 1 ; n->bound = get_bound(n); get_paths(n); } ////printf ( "\n"); // printf ("\n"); // printf ("# of tours %d\n",count_tours); // printf ("* represents a non-recursive call.\n"); // printf ("** represents a recursive call.\n"); printf ( "%f\n",best_length); for (i=1;i<=d;i++) { printf("%f %f\n",f1[best_path[i]],f2[best_path[i]]) ; } //echo best path }
int find_cmd_in_path(const char cmd[], size_t path_len, char path[]) { size_t i; size_t paths_count; char **paths; paths = get_paths(&paths_count); for(i = 0; i < paths_count; i++) { char tmp_path[PATH_MAX]; snprintf(tmp_path, sizeof(tmp_path), "%s/%s", paths[i], cmd); /* Need to check for executable, not just a file, as this additionally * checks for path with different executable extensions on Windows. */ if(executable_exists(tmp_path)) { if(path != NULL) { copy_str(path, path_len, tmp_path); } return 0; } } return 1; }
static bool do_format(const char *mountpoint) { if (!get_paths(mountpoint, nullptr, nullptr)) { LOGE(TAG "%s: Invalid mountpoint", mountpoint); return false; } bool needs_mount = !util::is_mounted(mountpoint); if (needs_mount && !do_mount(mountpoint)) { LOGE(TAG "%s: Failed to mount path", mountpoint); return false; } std::vector<std::string> exclusions; if (strcmp(mountpoint, DATA) == 0) { exclusions.push_back("media"); } if (!wipe_directory(mountpoint, exclusions)) { LOGE(TAG "%s: Failed to wipe directory", mountpoint); return false; } if (needs_mount && !do_unmount(mountpoint)) { LOGE(TAG "%s: Failed to unmount path", mountpoint); return false; } LOGD(TAG "Successfully formatted %s", mountpoint); return true; }
void validate_captcha(char *cfgfile, char *weightfile) { srand(time(0)); char *base = basecfg(cfgfile); printf("%s\n", base); network net = parse_network_cfg(cfgfile); if(weightfile){ load_weights(&net, weightfile); } int numchars = 37; list *plist = get_paths("/data/captcha/solved.hard"); char **paths = (char **)list_to_array(plist); int imgs = plist->size; data valid = load_data_captcha(paths, imgs, 0, 10, 200, 60); translate_data_rows(valid, -128); scale_data_rows(valid, 1./128); matrix pred = network_predict_data(net, valid); int i, k; int correct = 0; int total = 0; int accuracy = 0; for(i = 0; i < imgs; ++i){ int allcorrect = 1; for(k = 0; k < 10; ++k){ char truth = int_to_alphanum(max_index(valid.y.vals[i]+k*numchars, numchars)); char prediction = int_to_alphanum(max_index(pred.vals[i]+k*numchars, numchars)); if (truth != prediction) allcorrect=0; if (truth != '.' && truth == prediction) ++correct; if (truth != '.' || truth != prediction) ++total; } accuracy += allcorrect; } printf("Word Accuracy: %f, Char Accuracy %f\n", (float)accuracy/imgs, (float)correct/total); free_data(valid); }
void validate_imagenet(char *filename, char *weightfile) { int i = 0; network net = parse_network_cfg(filename, 1); if(weightfile){ load_weights(&net, weightfile); } srand(time(0)); char **labels = get_labels("data/inet.labels.list"); //list *plist = get_paths("data/inet.suppress.list"); list *plist = get_paths("data/inet.val.list"); char **paths = (char **)list_to_array(plist); int m = plist->size; free_list(plist); clock_t time; float avg_acc = 0; float avg_top5 = 0; int splits = 50; int num = (i+1)*m/splits - i*m/splits; data val, buffer; load_args args = {0}; args.w = net.w; args.h = net.h; args.paths = paths; args.classes = 1000; args.n = num; args.m = 0; args.labels = labels; args.d = &buffer; args.type = CLASSIFICATION_DATA; pthread_t load_thread = load_data_in_thread(args); for(i = 1; i <= splits; ++i){ time=clock(); pthread_join(load_thread, 0); val = buffer; num = (i+1)*m/splits - i*m/splits; char **part = paths+(i*m/splits); if(i != splits){ args.paths = part; load_thread = load_data_in_thread(args); } printf("Loaded: %d images in %lf seconds\n", val.X.rows, sec(clock()-time)); time=clock(); float *acc = network_accuracies(net, val, 5); avg_acc += acc[0]; avg_top5 += acc[1]; printf("%d: top1: %f, top5: %f, %lf seconds, %d images\n", i, avg_acc/i, avg_top5/i, sec(clock()-time), val.X.rows); free_data(val); } }
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)); } }
void get_nested_files(QString path, QStringList& found){ QStringList a_list; a_list.append(path); get_paths(a_list); found.append(store_paths(QStringList())); }
directory::directory() : data_object() { data::smart_pointer<char, true> buf(new char[MAX_PATH_SIZE]); ::_getcwd(buf, MAX_PATH_SIZE); name = string(buf); get_paths(); } // directory::directory()
void get_paths(QStringList paths){ QString str; foreach(str, paths){ if(has_children(str)){ get_paths(get_absolute_dir_paths(str)); store_paths(get_absolute_file_paths(str)); } } }
directory & directory::operator= (const directory & d) { files.clear(); dirs.clear(); name = d.name; get_paths(); return *this; } // directory::operator= ()
// **************************************************************** // * This function clears the screen, for our new shell to open * // * and prints the prompt for the first time. * // * Also, it gets all the paths where the system commands may be * // * stored, by calling get_paths(). * // **************************************************************** void initilize(char **envp) { char *cmd = calloc(BUFFERSIZE, sizeof(char*)); get_paths(envp); cmd = prepare_inputs(CLEAR); get_cmd_pth(cmd); cmd_exec(cmd, envp); sig_hdlr(0); free_arr(inputs); }
void train_imagenet(char *cfgfile, char *weightfile) { data_seed = time(0); srand(time(0)); float avg_loss = -1; char *base = basecfg(cfgfile); printf("%s\n", base); network net = parse_network_cfg(cfgfile); if(weightfile){ load_weights(&net, weightfile); } printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); //net.seen=0; int imgs = 1024; int i = net.seen/imgs; char **labels = get_labels("data/inet.labels.list"); list *plist = get_paths("/data/imagenet/cls.train.list"); char **paths = (char **)list_to_array(plist); printf("%d\n", plist->size); clock_t time; pthread_t load_thread; data train; data buffer; load_thread = load_data_thread(paths, imgs, plist->size, labels, 1000, 256, 256, &buffer); while(1){ ++i; time=clock(); pthread_join(load_thread, 0); train = buffer; /* image im = float_to_image(256, 256, 3, train.X.vals[114]); show_image(im, "training"); cvWaitKey(0); */ load_thread = load_data_thread(paths, imgs, plist->size, labels, 1000, 256, 256, &buffer); printf("Loaded: %lf seconds\n", sec(clock()-time)); time=clock(); float loss = train_network(net, train); net.seen += imgs; if(avg_loss == -1) avg_loss = loss; avg_loss = avg_loss*.9 + loss*.1; printf("%d: %f, %f avg, %lf seconds, %d images\n", i, loss, avg_loss, sec(clock()-time), net.seen); free_data(train); if((i % 20000) == 0) net.learning_rate *= .1; //if(i%100 == 0 && net.learning_rate > .00001) net.learning_rate *= .97; if(i%1000==0){ char buff[256]; sprintf(buff, "/home/pjreddie/imagenet_backup/%s_%d.weights",base, i); save_weights(net, buff); } } }
void get_paths(t_node node) { int i,j; //printf ("*"); if (is_promising(node)) { //printf ("<is promising> " ); if (is_tour(node)) { count_tours++; //printf ("<is a tour> " ); node->level = node->level+1; // dr. delcher, i completed the path. node->path[node->level] = node->path[1]; get_best_path(node); // keep track of the best path // for (i = 1 ; i <= node->level; i++) { printf ("%d ",node->path[i]); } printf (" \n"); } else // for each child of n { for (i = 2; i <= d ; i ++ ) { if (!in_path(i,node)) { t_node child; child=give_birth(node); child->bound = get_bound(node) ; // child->level = node->level+1 ; child=give_path(node,child); child->path[child->level] = i; // add this node to the path for (j=1;j<=( child->level );j++) { //printf ("%d ",child->path[j]); } // //printf ("\n"); //printf ("\n"); //printf ("**"); if (is_promising(child)) { // printf ("IN "); get_paths(child); // printf ("OUT "); } } } } } }
/* Fills list of complitions with executables in $PATH. */ static void complete_command_name(const char beginning[]) { int i; char ** paths; size_t paths_count; paths = get_paths(&paths_count); for(i = 0; i < paths_count; i++) { if(vifm_chdir(paths[i]) == 0) { filename_completion(beginning, CT_EXECONLY); } } vle_compl_add_last_path_match(beginning); }
void train_writing(char *cfgfile, char *weightfile) { data_seed = time(0); srand(time(0)); float avg_loss = -1; char *base = basecfg(cfgfile); printf("%s\n", base); network net = parse_network_cfg(cfgfile); if(weightfile){ load_weights(&net, weightfile); } printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); int imgs = 256; int i = net.seen/imgs; list *plist = get_paths("data/train.list"); char **paths = (char **)list_to_array(plist); printf("%d\n", plist->size); clock_t time; while(1){ ++i; time=clock(); data train = load_data_writing(paths, imgs, plist->size, 256, 256, 4); float loss = train_network(net, train); #ifdef GPU float *out = get_network_output_gpu(net); #else float *out = get_network_output(net); #endif // image pred = float_to_image(32, 32, 1, out); // print_image(pred); net.seen += imgs; if(avg_loss == -1) avg_loss = loss; avg_loss = avg_loss*.9 + loss*.1; printf("%d: %f, %f avg, %lf seconds, %d images\n", i, loss, avg_loss, sec(clock()-time), net.seen); free_data(train); if((i % 20000) == 0) net.learning_rate *= .1; //if(i%100 == 0 && net.learning_rate > .00001) net.learning_rate *= .97; if(i%250==0){ char buff[256]; sprintf(buff, "/home/pjreddie/writing_backup/%s_%d.weights", base, i); save_weights(net, buff); } } }
static bool do_unmount(const char *mountpoint) { if (!get_paths(mountpoint, nullptr, nullptr)) { LOGE(TAG "%s: Invalid mountpoint", mountpoint); return false; } // NOTE: We don't want to use util::umount() because it will disassociate // the loop device if (umount(mountpoint) < 0) { LOGE(TAG "%s: Failed to unmount: %s", mountpoint, strerror(errno)); return false; } LOGD(TAG "Successfully unmounted %s", mountpoint); return true; }
void change_leaves(tree *t, char *leaf_list) { list *llist = get_paths(leaf_list); char **leaves = (char **)list_to_array(llist); int n = llist->size; int i,j; int found = 0; for(i = 0; i < t->n; ++i){ t->leaf[i] = 0; for(j = 0; j < n; ++j){ if (0==strcmp(t->name[i], leaves[j])){ t->leaf[i] = 1; ++found; break; } } } fprintf(stderr, "Found %d leaves.\n", found); }
void validate_imagenet(char *filename, char *weightfile) { int i = 0; network net = parse_network_cfg(filename); if(weightfile){ load_weights(&net, weightfile); } srand(time(0)); char **labels = get_labels("data/inet.labels.list"); list *plist = get_paths("data/inet.val.list"); char **paths = (char **)list_to_array(plist); int m = plist->size; free_list(plist); clock_t time; float avg_acc = 0; float avg_top5 = 0; int splits = 50; int num = (i+1)*m/splits - i*m/splits; data val, buffer; pthread_t load_thread = load_data_thread(paths, num, 0, labels, 1000, 256, 256, &buffer); for(i = 1; i <= splits; ++i){ time=clock(); pthread_join(load_thread, 0); val = buffer; num = (i+1)*m/splits - i*m/splits; char **part = paths+(i*m/splits); if(i != splits) load_thread = load_data_thread(part, num, 0, labels, 1000, 256, 256, &buffer); printf("Loaded: %d images in %lf seconds\n", val.X.rows, sec(clock()-time)); time=clock(); float *acc = network_accuracies(net, val); avg_acc += acc[0]; avg_top5 += acc[1]; printf("%d: top1: %f, top5: %f, %lf seconds, %d images\n", i, avg_acc/i, avg_top5/i, sec(clock()-time), val.X.rows); free_data(val); } }
void validate_dice(char *filename, char *weightfile) { network * net = parse_network_cfg(filename); if(weightfile){ load_weights(net, weightfile); } srand(time(0)); char **labels = dice_labels; list *plist = get_paths("data/dice/dice.val.list"); char **paths = (char **)list_to_array(plist); int m = plist->size; free_list(plist); data val = load_data_old(paths, m, 0, labels, 6, net->w, net->h); float *acc = network_accuracies(net, val, 2); printf("Validation Accuracy: %f, %d images\n", acc[0], m); free_data(val); }
/* Get all possible moves that can be made on a grid. Comprimises are made to * compute the most moves in the smallest amount of time. */ void get_moves(grid_t grid, int allow_shrinkers, int *num_moves, move_list_t moves) { color_t color; mask_t color_mask, cycles, no_cycles; *num_moves = 0; for (color = RED; color <= VIOLET; color++) { color_mask = get_color_mask(grid, color); separate_cycles(color_mask, &cycles, &no_cycles); if (cycles) { get_cycles(cycles, color, num_moves, moves); } else { get_paths(no_cycles, allow_shrinkers, num_moves, moves); } } /* TODO: figure out how dots does this */ /*if ((allow_shrinkers && *num_moves == NUM_DOTS) || (!allow_shrinkers && *num_moves == 0)) { printf("WARNING/TODO: no moves possible without shrinkers\n"); }*/ }
int main(int argc, char **argv) { char* input = argv[1]; int channels = 3; list *plist = get_paths(input); //int N = plist->size; char **paths = (char **)list_to_array(plist); int m = plist->size; int count_label = 0; char labelpath[256]; sprintf(labelpath, "../labels/01_5_1.txt"); int count = 0; box_label *boxes = read_boxes(labelpath, &count); for (int i = 0; i < m; i++) { if (!paths[i]) { printf("load error!\n"); break; } image im = load_image(paths[i], 0, 0, channels); printf("load %s", paths[i]); float x, y, w, h; count_label++; x = boxes[i].x; y = boxes[i].y; w = boxes[i].w; h = boxes[i].h; box box = { x, y, w, h }; char *save_path1 = get_basename(paths[i]); char save_path[256]; sprintf(save_path, "./images/%s", save_path1); //show_image(im, save_path); image crop_im = crop_image(im, x,y,w,h); printf(" %f %f %f %f \n", x,y,w,h); show_image(crop_im, save_path); free_image(crop_im); free_image(im); } }
char *do_lemin_algo(t_resources *resources) { int sns; int ens; int max_way; if (!resources->start || !resources->end || set_nighs_cells(resources) == -1) return ("ERROR\n"); if (get_paths(resources, NULL, resources->start, NULL) == -1) return ("ERROR\n"); if (resources->paths == NULL) return ("ERROR\n"); if (sort_paths(resources) == -1) return ("ERROR\n"); sns = get_size_list_nighs(resources->start->nighs); ens = get_size_list_nighs(resources->end->nighs); max_way = sns < ens ? sns : ens; resources->final_paths = get_final_paths(resources, max_way); return (""); }
void valid_captcha(char *cfgfile, char *weightfile, char *filename) { char **labels = get_labels("/data/captcha/reimgs.labels.list"); network net = parse_network_cfg(cfgfile); if(weightfile){ load_weights(&net, weightfile); } list *plist = get_paths("/data/captcha/reimgs.fg.list"); char **paths = (char **)list_to_array(plist); int N = plist->size; int outputs = net.outputs; set_batch_network(&net, 1); srand(2222222); int i, j; for(i = 0; i < N; ++i){ if (i%100 == 0) fprintf(stderr, "%d\n", i); image im = load_image_color(paths[i], net.w, net.h); float *X = im.data; float *predictions = network_predict(net, X); //printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time)); int truth = -1; for(j = 0; j < 13; ++j){ if (strstr(paths[i], labels[j])) truth = j; } if (truth == -1){ fprintf(stderr, "bad: %s\n", paths[i]); return; } printf("%d, ", truth); for(j = 0; j < outputs; ++j){ if (j != 0) printf(", "); printf("%f", predictions[j]); } printf("\n"); fflush(stdout); free_image(im); if (filename) break; } }
void train_dice(char *cfgfile, char *weightfile) { data_seed = time(0); srand(time(0)); float avg_loss = -1; char *base = basecfg(cfgfile); char *backup_directory = "/home/pjreddie/backup/"; printf("%s\n", base); network net = parse_network_cfg(cfgfile); if(weightfile){ load_weights(&net, weightfile); } printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); int imgs = 1024; int i = *net.seen/imgs; char **labels = dice_labels; list *plist = get_paths("data/dice/dice.train.list"); char **paths = (char **)list_to_array(plist); printf("%d\n", plist->size); clock_t time; while(1){ ++i; time=clock(); data train = load_data(paths, imgs, plist->size, labels, 6, net.w, net.h); printf("Loaded: %lf seconds\n", sec(clock()-time)); time=clock(); float loss = train_network(net, train); if(avg_loss == -1) avg_loss = loss; avg_loss = avg_loss*.9 + loss*.1; printf("%d: %f, %f avg, %lf seconds, %d images\n", i, loss, avg_loss, sec(clock()-time), *net.seen); free_data(train); if((i % 100) == 0) net.learning_rate *= .1; if(i%100==0){ char buff[256]; sprintf(buff, "%s/%s_%d.weights",backup_directory,base, i); save_weights(net, buff); } } }
void train_captcha(char *cfgfile, char *weightfile) { float avg_loss = -1; srand(time(0)); char *base = basecfg(cfgfile); printf("%s\n", base); network net = parse_network_cfg(cfgfile); if(weightfile){ load_weights(&net, weightfile); } printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); int imgs = 1024; int i = net.seen/imgs; list *plist = get_paths("/data/captcha/train.auto5"); char **paths = (char **)list_to_array(plist); printf("%d\n", plist->size); clock_t time; while(1){ ++i; time=clock(); data train = load_data_captcha(paths, imgs, plist->size, 10, 200, 60); translate_data_rows(train, -128); scale_data_rows(train, 1./128); printf("Loaded: %lf seconds\n", sec(clock()-time)); time=clock(); float loss = train_network(net, train); net.seen += imgs; if(avg_loss == -1) avg_loss = loss; avg_loss = avg_loss*.9 + loss*.1; printf("%d: %f, %f avg, %lf seconds, %d images\n", i, loss, avg_loss, sec(clock()-time), net.seen); free_data(train); if(i%10==0){ char buff[256]; sprintf(buff, "/home/pjreddie/imagenet_backup/%s_%d.weights",base, i); save_weights(net, buff); } } }