| | |
| | | int n = option_find_int(options, "filters",1); |
| | | int size = option_find_int(options, "size",1); |
| | | int stride = option_find_int(options, "stride",1); |
| | | char *activation_s = option_find_str(options, "activation", "sigmoid"); |
| | | char *activation_s = option_find_str(options, "activation", "logistic"); |
| | | ACTIVATION activation = get_activation(activation_s); |
| | | if(count == 0){ |
| | | learning_rate = option_find_float(options, "learning_rate", .001); |
| | |
| | | int size = option_find_int(options, "size",1); |
| | | int stride = option_find_int(options, "stride",1); |
| | | int pad = option_find_int(options, "pad",0); |
| | | char *activation_s = option_find_str(options, "activation", "sigmoid"); |
| | | char *activation_s = option_find_str(options, "activation", "logistic"); |
| | | ACTIVATION activation = get_activation(activation_s); |
| | | if(count == 0){ |
| | | learning_rate = option_find_float(options, "learning_rate", .001); |
| | |
| | | int input; |
| | | float learning_rate, momentum, decay; |
| | | int output = option_find_int(options, "output",1); |
| | | char *activation_s = option_find_str(options, "activation", "sigmoid"); |
| | | char *activation_s = option_find_str(options, "activation", "logistic"); |
| | | ACTIVATION activation = get_activation(activation_s); |
| | | if(count == 0){ |
| | | input = option_find_int(options, "input",1); |
| | |
| | | fclose(fp); |
| | | } |
| | | |
| | | void load_weights(network *net, char *filename) |
| | | void load_weights_upto(network *net, char *filename, int cutoff) |
| | | { |
| | | fprintf(stderr, "Loading weights from %s\n", filename); |
| | | FILE *fp = fopen(filename, "r"); |
| | |
| | | set_learning_network(net, net->learning_rate, net->momentum, net->decay); |
| | | |
| | | int i; |
| | | for(i = 0; i < net->n; ++i){ |
| | | for(i = 0; i < net->n && i < cutoff; ++i){ |
| | | if(net->types[i] == CONVOLUTIONAL){ |
| | | convolutional_layer layer = *(convolutional_layer *) net->layers[i]; |
| | | int num = layer.n*layer.c*layer.size*layer.size; |
| | |
| | | fclose(fp); |
| | | } |
| | | |
| | | void load_weights(network *net, char *filename) |
| | | { |
| | | load_weights_upto(net, filename, net->n); |
| | | } |
| | | |
| | | void save_network(network net, char *filename) |
| | | { |
| | | FILE *fp = fopen(filename, "w"); |