From 9fbd1936ebed466aad50c52989b92d5e3fedc099 Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Fri, 30 Mar 2018 11:32:41 +0000
Subject: [PATCH] small_object can be used in [net] in cfg-file for objects 1x1 pix on FullHD image

---
 src/data.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/data.c b/src/data.c
index d9cedf5..f087cd4 100644
--- a/src/data.c
+++ b/src/data.c
@@ -308,8 +308,8 @@
     box_label *boxes = read_boxes(labelpath, &count);
 	if (small_object == 1) {
 		for (i = 0; i < count; ++i) {
-			if (boxes[i].w < 0.01) boxes[i].w = 0.01;
-			if (boxes[i].h < 0.01) boxes[i].h = 0.01;
+			if (boxes[i].w < 0.001F) boxes[i].w = 0.001F;
+			if (boxes[i].h < 0.001F) boxes[i].h = 0.001F;
 		}
 	}
     randomize_boxes(boxes, count);
@@ -326,7 +326,7 @@
         id = boxes[i].id;
 
 		// not detect small objects
-		if ((w < 0.001 || h < 0.001)) continue;
+		if ((w < 0.001F || h < 0.001F)) continue;
 
         truth[i*5+0] = x;
         truth[i*5+1] = y;
@@ -827,6 +827,9 @@
     } else if (a.type == IMAGE_DATA){
         *(a.im) = load_image_color(a.path, 0, 0);
         *(a.resized) = resize_image(*(a.im), a.w, a.h);
+	}else if (a.type == LETTERBOX_DATA) {
+		*(a.im) = load_image_color(a.path, 0, 0);
+		*(a.resized) = letterbox_image(*(a.im), a.w, a.h);
     } else if (a.type == TAG_DATA){
         *a.d = load_data_tag(a.paths, a.n, a.m, a.classes, a.min, a.max, a.size, a.angle, a.aspect, a.hue, a.saturation, a.exposure);
     }

--
Gitblit v1.10.0