AlexeyAB
2018-04-16 701f4fab63b3f6826ae6095ce32b9b99b3ece203
src/network.c
@@ -28,6 +28,19 @@
#include "route_layer.h"
#include "shortcut_layer.h"
#include "yolo_layer.h"
#include "parser.h"
network *load_network(char *cfg, char *weights, int clear)
{
   printf(" Try to load cfg: %s, weights: %s, clear = %d \n", cfg, weights, clear);
   network *net = calloc(1, sizeof(network));
   *net = parse_network_cfg(cfg);
   if (weights && weights[0] != 0) {
      load_weights(net, weights);
   }
   if (clear) (*net->seen) = 0;
   return net;
}
int get_current_batch(network net)
{
@@ -46,6 +59,27 @@
    #endif
}
void reset_network_state(network *net, int b)
{
   int i;
   for (i = 0; i < net->n; ++i) {
#ifdef GPU
      layer l = net->layers[i];
      if (l.state_gpu) {
         fill_ongpu(l.outputs, 0, l.state_gpu + l.outputs*b, 1);
      }
      if (l.h_gpu) {
         fill_ongpu(l.outputs, 0, l.h_gpu + l.outputs*b, 1);
      }
#endif
   }
}
void reset_rnn(network *net)
{
   reset_network_state(net, 0);
}
float get_current_rate(network net)
{
    int batch_num = get_current_batch(net);
@@ -555,6 +589,9 @@
   free(boxes);
   free_ptrs((void **)probs, l.w*l.h*l.n);
   //correct_region_boxes(dets, l.w*l.h*l.n, w, h, net_w, net_h, relative);
   correct_yolo_boxes(dets, l.w*l.h*l.n, w, h, net_w, net_h, relative, letter);
}
void fill_network_boxes(network *net, int w, int h, float thresh, float hier, int *map, int relative, detection *dets, int letter)
@@ -757,7 +794,7 @@
      layer *l = &net.layers[j];
      if (l->type == CONVOLUTIONAL) {
         printf(" Fuse Convolutional layer \t\t l->size = %d  \n", l->size);
         //printf(" Merges Convolutional-%d and batch_norm \n", j);
         if (l->batch_normalize) {
            int f;
@@ -783,7 +820,7 @@
         }
      }
      else {
         printf(" Skip layer: %d \n", l->type);
         //printf(" Fusion skip layer type: %d \n", l->type);
      }
   }
}