From d9ae3dd681ed1c98e807ff937dbbb9cfc4d19fe0 Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Tue, 27 Mar 2018 23:59:03 +0000
Subject: [PATCH] Added Yolo v3
---
src/tree.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/src/tree.c b/src/tree.c
index dfa4178..35ac3de 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -50,6 +50,38 @@
}
}
+int hierarchy_top_prediction(float *predictions, tree *hier, float thresh, int stride)
+{
+ float p = 1;
+ int group = 0;
+ int i;
+ while (1) {
+ float max = 0;
+ int max_i = 0;
+
+ for (i = 0; i < hier->group_size[group]; ++i) {
+ int index = i + hier->group_offset[group];
+ float val = predictions[(i + hier->group_offset[group])*stride];
+ if (val > max) {
+ max_i = index;
+ max = val;
+ }
+ }
+ if (p*max > thresh) {
+ p = p*max;
+ group = hier->child[max_i];
+ if (hier->child[max_i] < 0) return max_i;
+ }
+ else if (group == 0) {
+ return max_i;
+ }
+ else {
+ return hier->parent[hier->group_offset[group]];
+ }
+ }
+ return 0;
+}
+
tree *read_tree(char *filename)
{
tree t = {0};
--
Gitblit v1.10.0