:fire: :fire: :dragonite:
| | |
| | | |
| | | avgpool_layer make_avgpool_layer(int batch, int w, int h, int c) |
| | | { |
| | | fprintf(stderr, "Avgpool Layer: %d x %d x %d image\n", w,h,c); |
| | | fprintf(stderr, "avg %4d x%4d x%4d -> %4d\n", w, h, c, c); |
| | | avgpool_layer l = {0}; |
| | | l.type = AVGPOOL; |
| | | l.batch = batch; |
| | |
| | | } |
| | | #endif |
| | | l.activation = activation; |
| | | fprintf(stderr, "Connected Layer: %d inputs, %d outputs\n", inputs, outputs); |
| | | fprintf(stderr, "connected %4d -> %4d\n", inputs, outputs); |
| | | return l; |
| | | } |
| | | |
| | |
| | | l.workspace_size = get_workspace_size(l); |
| | | l.activation = activation; |
| | | |
| | | fprintf(stderr, "Convolutional Layer: %d x %d x %d image, %d filters -> %d x %d x %d image\n", h,w,c,n, out_h, out_w, n); |
| | | fprintf(stderr, "conv %5d %2d x%2d /%2d %4d x%4d x%4d -> %4d x%4d x%4d\n", n, size, size, stride, w, h, c, l.out_w, l.out_h, l.out_c); |
| | | |
| | | return l; |
| | | } |
| | |
| | | |
| | | cost_layer make_cost_layer(int batch, int inputs, COST_TYPE cost_type, float scale) |
| | | { |
| | | fprintf(stderr, "Cost Layer: %d inputs\n", inputs); |
| | | fprintf(stderr, "cost %4d\n", inputs); |
| | | cost_layer l = {0}; |
| | | l.type = COST; |
| | | |
| | |
| | | |
| | | i = get_current_batch(net); |
| | | printf("%d: %f, %f avg, %f rate, %lf seconds, %d images\n", get_current_batch(net), loss, avg_loss, get_current_rate(net), sec(clock()-time), i*imgs); |
| | | if(i%100==0 || (i < 1000 && i%100 == 0)){ |
| | | if(i%1000==0 || (i < 1000 && i%100 == 0)){ |
| | | #ifdef GPU |
| | | if(ngpus != 1) sync_nets(nets, ngpus, 0); |
| | | #endif |
| | | char buff[256]; |
| | | sprintf(buff, "%s/%s_%d.weights", backup_directory, base, i); |
| | | save_weights(net, buff); |
| | | } |
| | | free_data(train); |
| | | } |
| | | #ifdef GPU |
| | | if(ngpus != 1) sync_nets(nets, ngpus, 0); |
| | | #endif |
| | | char buff[256]; |
| | | sprintf(buff, "%s/%s_final.weights", backup_directory, base); |
| | | save_weights(net, buff); |
| | |
| | | |
| | | dropout_layer make_dropout_layer(int batch, int inputs, float probability) |
| | | { |
| | | fprintf(stderr, "Dropout Layer: %d inputs, %f probability\n", inputs, probability); |
| | | dropout_layer l = {0}; |
| | | l.type = DROPOUT; |
| | | l.probability = probability; |
| | |
| | | l.backward_gpu = backward_dropout_layer_gpu; |
| | | l.rand_gpu = cuda_make_array(l.rand, inputs*batch); |
| | | #endif |
| | | fprintf(stderr, "dropout p = %.2f %4d -> %4d\n", probability, inputs, inputs); |
| | | return l; |
| | | } |
| | | |
| | |
| | | |
| | | maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int stride, int padding) |
| | | { |
| | | fprintf(stderr, "Maxpool Layer: %d x %d x %d image, %d size, %d stride\n", h,w,c,size,stride); |
| | | maxpool_layer l = {0}; |
| | | l.type = MAXPOOL; |
| | | l.batch = batch; |
| | |
| | | l.output_gpu = cuda_make_array(l.output, output_size); |
| | | l.delta_gpu = cuda_make_array(l.delta, output_size); |
| | | #endif |
| | | fprintf(stderr, "max %d x %d / %d %4d x%4d x%4d -> %4d x%4d x%4d\n", size, size, stride, w, h, c, l.out_w, l.out_h, l.out_c); |
| | | return l; |
| | | } |
| | | |
| | |
| | | n = n->next; |
| | | int count = 0; |
| | | free_section(s); |
| | | fprintf(stderr, "layer filters size input output\n"); |
| | | while(n){ |
| | | params.index = count; |
| | | fprintf(stderr, "%d: ", count); |
| | | fprintf(stderr, "%5d ", count); |
| | | s = (section *)n->val; |
| | | options = s->options; |
| | | layer l = {0}; |
| | |
| | | softmax_layer make_softmax_layer(int batch, int inputs, int groups) |
| | | { |
| | | assert(inputs%groups == 0); |
| | | fprintf(stderr, "Softmax Layer: %d inputs\n", inputs); |
| | | fprintf(stderr, "softmax %4d\n", inputs); |
| | | softmax_layer l = {0}; |
| | | l.type = SOFTMAX; |
| | | l.batch = batch; |