From 032acd408acd119a5bd5c132765fcdd6caedea6b Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Tue, 22 May 2018 13:38:04 +0000
Subject: [PATCH] Experimental reinforcement learning.
---
src/detector.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/src/detector.c b/src/detector.c
index 6150df4..8b53907 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -542,6 +542,7 @@
char *mapf = option_find_str(options, "map", 0);
int *map = 0;
if (mapf) map = read_map(mapf);
+ FILE* reinforcement_fd = NULL;
network net = parse_network_cfg_custom(cfgfile, 1); // set batch=1
if (weightfile) {
@@ -720,9 +721,18 @@
}
}
}
-
+
unique_truth_count += num_labels;
+ //static int previous_errors = 0;
+ //int total_errors = fp_for_thresh + (unique_truth_count - tp_for_thresh);
+ //int errors_in_this_image = total_errors - previous_errors;
+ //previous_errors = total_errors;
+ //if(reinforcement_fd == NULL) reinforcement_fd = fopen("reinforcement.txt", "wb");
+ //char buff[1000];
+ //sprintf(buff, "%s\n", path);
+ //if(errors_in_this_image > 0) fwrite(buff, sizeof(char), strlen(buff), reinforcement_fd);
+
free_detections(dets, nboxes);
free(id);
free_image(val[t]);
@@ -843,6 +853,7 @@
free(truth_classes_count);
fprintf(stderr, "Total Detection Time: %f Seconds\n", (double)(time(0) - start));
+ if (reinforcement_fd != NULL) fclose(reinforcement_fd);
}
#ifdef OPENCV
--
Gitblit v1.10.0