| | |
| | | #ifdef _DEBUG |
| | | #include <stdlib.h> |
| | | #include <crtdbg.h> |
| | | #endif |
| | | |
| | | #include "network.h" |
| | | #include "region_layer.h" |
| | | #include "cost_layer.h" |
| | |
| | | avg_loss = avg_loss*.9 + loss*.1; |
| | | |
| | | i = get_current_batch(net); |
| | | printf("\n %d: %f, %f avg, %f rate, %lf seconds, %d images\n", get_current_batch(net), loss, avg_loss, get_current_rate(net), (what_time_is_it_now()-time), i*imgs); |
| | | printf("\n %d: %f, %f avg loss, %f rate, %lf seconds, %d images\n", get_current_batch(net), loss, avg_loss, get_current_rate(net), (what_time_is_it_now()-time), i*imgs); |
| | | |
| | | #ifdef OPENCV |
| | | if(!dont_show) |
| | |
| | | sprintf(buff, "%s/%s_final.weights", backup_directory, base); |
| | | save_weights(net, buff); |
| | | |
| | | //cvReleaseImage(&img); |
| | | //cvDestroyAllWindows(); |
| | | #ifdef OPENCV |
| | | cvReleaseImage(&img); |
| | | cvDestroyAllWindows(); |
| | | #endif |
| | | |
| | | // free memory |
| | | pthread_join(load_thread, 0); |
| | | free_data(buffer); |
| | | |
| | | free(base); |
| | | free(paths); |
| | | free_list_contents(plist); |
| | | free_list(plist); |
| | | |
| | | free_list_contents_kvp(options); |
| | | free_list(options); |
| | | |
| | | free(nets); |
| | | free_network(net); |
| | | } |
| | | |
| | | |
| | |
| | | char *mapf = option_find_str(options, "map", 0); |
| | | int *map = 0; |
| | | if (mapf) map = read_map(mapf); |
| | | FILE* reinforcement_fd = NULL; |
| | | |
| | | network net = parse_network_cfg_custom(cfgfile, 1); // set batch=1 |
| | | if (weightfile) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | unique_truth_count += num_labels; |
| | | |
| | | //static int previous_errors = 0; |
| | | //int total_errors = fp_for_thresh + (unique_truth_count - tp_for_thresh); |
| | | //int errors_in_this_image = total_errors - previous_errors; |
| | | //previous_errors = total_errors; |
| | | //if(reinforcement_fd == NULL) reinforcement_fd = fopen("reinforcement.txt", "wb"); |
| | | //char buff[1000]; |
| | | //sprintf(buff, "%s\n", path); |
| | | //if(errors_in_this_image > 0) fwrite(buff, sizeof(char), strlen(buff), reinforcement_fd); |
| | | |
| | | free_detections(dets, nboxes); |
| | | free(id); |
| | | free_image(val[t]); |
| | |
| | | free(truth_classes_count); |
| | | |
| | | fprintf(stderr, "Total Detection Time: %f Seconds\n", (double)(time(0) - start)); |
| | | if (reinforcement_fd != NULL) fclose(reinforcement_fd); |
| | | } |
| | | |
| | | #ifdef OPENCV |
| | |
| | | |
| | | // free memory |
| | | free_ptrs(names, net.layers[net.n - 1].classes); |
| | | free_list_contents_kvp(options); |
| | | free_list(options); |
| | | |
| | | int i; |
| | |
| | | if (filename[strlen(filename) - 1] == 0x0d) filename[strlen(filename) - 1] = 0; |
| | | demo(cfg, weights, thresh, hier_thresh, cam_index, filename, names, classes, frame_skip, prefix, out_filename, |
| | | http_stream_port, dont_show, ext_output); |
| | | |
| | | free_list_contents_kvp(options); |
| | | free_list(options); |
| | | } |
| | | else printf(" There isn't such command: %s", argv[2]); |
| | | } |