Commit
·
11ba529
1
Parent(s):
659ad74
update get_voc.sh
Browse files- data/get_voc.sh +19 -18
data/get_voc.sh
CHANGED
@@ -11,10 +11,10 @@ start=`date +%s`
|
|
11 |
# handle optional download dir
|
12 |
if [ -z "$1" ]
|
13 |
then
|
14 |
-
# navigate to ~/
|
15 |
-
echo "navigating to ../
|
16 |
-
mkdir -p ../
|
17 |
-
cd ../
|
18 |
else
|
19 |
# check if is valid directory
|
20 |
if [ ! -d $1 ]; then
|
@@ -51,10 +51,10 @@ start=`date +%s`
|
|
51 |
# handle optional download dir
|
52 |
if [ -z "$1" ]
|
53 |
then
|
54 |
-
# navigate to ~/
|
55 |
-
echo "navigating to ../
|
56 |
-
mkdir -p ../
|
57 |
-
cd ../
|
58 |
else
|
59 |
# check if is valid directory
|
60 |
if [ ! -d $1 ]; then
|
@@ -82,7 +82,7 @@ runtime=$((end-start))
|
|
82 |
|
83 |
echo "Completed in" $runtime "seconds"
|
84 |
|
85 |
-
cd ../
|
86 |
echo "Spliting dataset..."
|
87 |
python3 - "$@" <<END
|
88 |
import xml.etree.ElementTree as ET
|
@@ -160,8 +160,8 @@ os.system('mkdir ../VOC/labels/train')
|
|
160 |
os.system('mkdir ../VOC/labels/val')
|
161 |
|
162 |
import os
|
163 |
-
print(os.path.exists('../
|
164 |
-
f = open('../
|
165 |
lines = f.readlines()
|
166 |
|
167 |
for line in lines:
|
@@ -171,8 +171,8 @@ for line in lines:
|
|
171 |
if (os.path.exists("../" + line[:-1])):
|
172 |
os.system("cp ../"+ line[:-1] + " ../VOC/images/train")
|
173 |
|
174 |
-
print(os.path.exists('../
|
175 |
-
f = open('../
|
176 |
lines = f.readlines()
|
177 |
|
178 |
for line in lines:
|
@@ -184,8 +184,8 @@ for line in lines:
|
|
184 |
if (os.path.exists("../" + line[:-1])):
|
185 |
os.system("cp ../"+ line[:-1] + " ../VOC/labels/train")
|
186 |
|
187 |
-
print(os.path.exists('../
|
188 |
-
f = open('../
|
189 |
lines = f.readlines()
|
190 |
|
191 |
for line in lines:
|
@@ -195,8 +195,8 @@ for line in lines:
|
|
195 |
if (os.path.exists("../" + line[:-1])):
|
196 |
os.system("cp ../"+ line[:-1] + " ../VOC/images/val")
|
197 |
|
198 |
-
print(os.path.exists('../
|
199 |
-
f = open('../
|
200 |
lines = f.readlines()
|
201 |
|
202 |
for line in lines:
|
@@ -210,4 +210,5 @@ for line in lines:
|
|
210 |
|
211 |
END
|
212 |
|
213 |
-
rm -rf ../
|
|
|
|
11 |
# handle optional download dir
|
12 |
if [ -z "$1" ]
|
13 |
then
|
14 |
+
# navigate to ~/tmp
|
15 |
+
echo "navigating to ../tmp/ ..."
|
16 |
+
mkdir -p ../tmp
|
17 |
+
cd ../tmp/
|
18 |
else
|
19 |
# check if is valid directory
|
20 |
if [ ! -d $1 ]; then
|
|
|
51 |
# handle optional download dir
|
52 |
if [ -z "$1" ]
|
53 |
then
|
54 |
+
# navigate to ~/tmp
|
55 |
+
echo "navigating to ../tmp/ ..."
|
56 |
+
mkdir -p ../tmp
|
57 |
+
cd ../tmp/
|
58 |
else
|
59 |
# check if is valid directory
|
60 |
if [ ! -d $1 ]; then
|
|
|
82 |
|
83 |
echo "Completed in" $runtime "seconds"
|
84 |
|
85 |
+
cd ../tmp
|
86 |
echo "Spliting dataset..."
|
87 |
python3 - "$@" <<END
|
88 |
import xml.etree.ElementTree as ET
|
|
|
160 |
os.system('mkdir ../VOC/labels/val')
|
161 |
|
162 |
import os
|
163 |
+
print(os.path.exists('../tmp/train.txt'))
|
164 |
+
f = open('../tmp/train.txt', 'r')
|
165 |
lines = f.readlines()
|
166 |
|
167 |
for line in lines:
|
|
|
171 |
if (os.path.exists("../" + line[:-1])):
|
172 |
os.system("cp ../"+ line[:-1] + " ../VOC/images/train")
|
173 |
|
174 |
+
print(os.path.exists('../tmp/train.txt'))
|
175 |
+
f = open('../tmp/train.txt', 'r')
|
176 |
lines = f.readlines()
|
177 |
|
178 |
for line in lines:
|
|
|
184 |
if (os.path.exists("../" + line[:-1])):
|
185 |
os.system("cp ../"+ line[:-1] + " ../VOC/labels/train")
|
186 |
|
187 |
+
print(os.path.exists('../tmp/2007_test.txt'))
|
188 |
+
f = open('../tmp/2007_test.txt', 'r')
|
189 |
lines = f.readlines()
|
190 |
|
191 |
for line in lines:
|
|
|
195 |
if (os.path.exists("../" + line[:-1])):
|
196 |
os.system("cp ../"+ line[:-1] + " ../VOC/images/val")
|
197 |
|
198 |
+
print(os.path.exists('../tmp/2007_test.txt'))
|
199 |
+
f = open('../tmp/2007_test.txt', 'r')
|
200 |
lines = f.readlines()
|
201 |
|
202 |
for line in lines:
|
|
|
210 |
|
211 |
END
|
212 |
|
213 |
+
rm -rf ../tmp # remove temporary directory
|
214 |
+
echo "VOC download done."
|