| | |
| | | int top = (y-h/2)*im.h; |
| | | int bot = (y+h/2)*im.h; |
| | | draw_box(im, left, top, right, bot, red, green, blue); |
| | | draw_box(im, left+1, top+1, right+1, bot+1, red, green, blue); |
| | | draw_box(im, left-1, top-1, right-1, bot-1, red, green, blue); |
| | | } |
| | | } |
| | | } |
| | |
| | | time=clock(); |
| | | float loss = train_network(net, train); |
| | | |
| | | //TODO |
| | | #ifdef GPU |
| | | float *out = get_network_output_gpu(net); |
| | | #else |
| | | float *out = get_network_output(net); |
| | | #endif |
| | | image im = float_to_image(net.w, net.h, 3, train.X.vals[127]); |
| | | image copy = copy_image(im); |
| | | draw_localization(copy, &(out[63*80])); |
| | |
| | | if(weightfile){ |
| | | load_weights(&net, weightfile); |
| | | } |
| | | detection_layer *layer = get_network_detection_layer(net); |
| | | detection_layer layer = get_network_detection_layer(net); |
| | | net.learning_rate = 0; |
| | | net.decay = 0; |
| | | printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); |
| | |
| | | int i = net.seen/imgs; |
| | | data train, buffer; |
| | | |
| | | int classes = layer->classes; |
| | | int background = layer->background; |
| | | int side = sqrt(get_detection_layer_locations(*layer)); |
| | | int classes = layer.classes; |
| | | int background = layer.background; |
| | | int side = sqrt(get_detection_layer_locations(layer)); |
| | | |
| | | char **paths; |
| | | list *plist; |
| | |
| | | paths = (char **)list_to_array(plist); |
| | | pthread_t load_thread = load_data_detection_thread(imgs, paths, plist->size, classes, net.w, net.h, side, side, background, &buffer); |
| | | clock_t time; |
| | | cost_layer clayer = *((cost_layer *)net.layers[net.n-1]); |
| | | cost_layer clayer = net.layers[net.n-1]; |
| | | while(1){ |
| | | i += 1; |
| | | time=clock(); |
| | |
| | | avg_loss = avg_loss*.9 + loss*.1; |
| | | printf("%d: %f, %f avg, %lf seconds, %d images\n", i, loss, avg_loss, sec(clock()-time), i*imgs); |
| | | if(i == 100){ |
| | | net.learning_rate *= 10; |
| | | //net.learning_rate *= 10; |
| | | } |
| | | if(i%100==0){ |
| | | char buff[256]; |
| | |
| | | if(weightfile){ |
| | | load_weights(&net, weightfile); |
| | | } |
| | | detection_layer *layer = get_network_detection_layer(net); |
| | | detection_layer layer = get_network_detection_layer(net); |
| | | printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); |
| | | int imgs = 128; |
| | | int i = net.seen/imgs; |
| | | data train, buffer; |
| | | |
| | | int classes = layer->classes; |
| | | int background = layer->background; |
| | | int side = sqrt(get_detection_layer_locations(*layer)); |
| | | int classes = layer.classes; |
| | | int background = layer.background; |
| | | int side = sqrt(get_detection_layer_locations(layer)); |
| | | |
| | | char **paths; |
| | | list *plist; |
| | |
| | | if(weightfile){ |
| | | load_weights(&net, weightfile); |
| | | } |
| | | detection_layer *layer = get_network_detection_layer(net); |
| | | detection_layer layer = get_network_detection_layer(net); |
| | | fprintf(stderr, "Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); |
| | | srand(time(0)); |
| | | |
| | |
| | | //list *plist = get_paths("/home/pjreddie/data/voc/train.txt"); |
| | | char **paths = (char **)list_to_array(plist); |
| | | |
| | | int classes = layer->classes; |
| | | int nuisance = layer->nuisance; |
| | | int background = (layer->background && !nuisance); |
| | | int num_boxes = sqrt(get_detection_layer_locations(*layer)); |
| | | int classes = layer.classes; |
| | | int nuisance = layer.nuisance; |
| | | int background = (layer.background && !nuisance); |
| | | int num_boxes = sqrt(get_detection_layer_locations(layer)); |
| | | |
| | | int per_box = 4+classes+background+nuisance; |
| | | int num_output = num_boxes*num_boxes*per_box; |
| | |
| | | load_weights(&post, "/home/pjreddie/imagenet_backup/localize_1000.weights"); |
| | | set_batch_network(&post, 1); |
| | | |
| | | detection_layer *layer = get_network_detection_layer(net); |
| | | detection_layer layer = get_network_detection_layer(net); |
| | | fprintf(stderr, "Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); |
| | | srand(time(0)); |
| | | |
| | |
| | | //list *plist = get_paths("/home/pjreddie/data/voc/train.txt"); |
| | | char **paths = (char **)list_to_array(plist); |
| | | |
| | | int classes = layer->classes; |
| | | int nuisance = layer->nuisance; |
| | | int background = (layer->background && !nuisance); |
| | | int num_boxes = sqrt(get_detection_layer_locations(*layer)); |
| | | int classes = layer.classes; |
| | | int nuisance = layer.nuisance; |
| | | int background = (layer.background && !nuisance); |
| | | int num_boxes = sqrt(get_detection_layer_locations(layer)); |
| | | |
| | | int per_box = 4+classes+background+nuisance; |
| | | |