From dfbec7ea2bf7d324fe80647dde72957683539974 Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Wed, 18 Jul 2018 12:08:34 +0000
Subject: [PATCH] PascalVOC label scripts are updated

---
 scripts/voc_label.py |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/scripts/voc_label.py b/scripts/voc_label.py
index d1e8823..679fc36 100644
--- a/scripts/voc_label.py
+++ b/scripts/voc_label.py
@@ -10,10 +10,10 @@
 
 
 def convert(size, box):
-    dw = 1./size[0]
-    dh = 1./size[1]
-    x = (box[0] + box[1])/2.0
-    y = (box[2] + box[3])/2.0
+    dw = 1./(size[0])
+    dh = 1./(size[1])
+    x = (box[0] + box[1])/2.0 - 1
+    y = (box[2] + box[3])/2.0 - 1
     w = box[1] - box[0]
     h = box[3] - box[2]
     x = x*dw
@@ -34,7 +34,7 @@
     for obj in root.iter('object'):
         difficult = obj.find('difficult').text
         cls = obj.find('name').text
-        if cls not in classes or int(difficult) == 1:
+        if cls not in classes or int(difficult)==1:
             continue
         cls_id = classes.index(cls)
         xmlbox = obj.find('bndbox')
@@ -54,3 +54,6 @@
         convert_annotation(year, image_id)
     list_file.close()
 
+os.system("cat 2007_train.txt 2007_val.txt 2012_train.txt 2012_val.txt > train.txt")
+os.system("cat 2007_train.txt 2007_val.txt 2007_test.txt 2012_train.txt 2012_val.txt > train.all.txt")
+

--
Gitblit v1.10.0