Yolo can be used from Python 2.x using /darknet.py on Linux or darknet/x64/darknet.py on Windows

This commit is contained in:
AlexeyAB
2018-04-12 22:32:57 +03:00
parent d75854c0fd
commit fc496d52bf
17 changed files with 476 additions and 27 deletions

View File

@ -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 @@ void reset_momentum(network net)
#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);