update get_voc.sh

pull/1/head
Glenn Jocher 5 years ago
parent 659ad748c8
commit 11ba5294dd

@ -11,10 +11,10 @@ start=`date +%s`
# handle optional download dir # handle optional download dir
if [ -z "$1" ] if [ -z "$1" ]
then then
# navigate to ~/data # navigate to ~/tmp
echo "navigating to ../data/ ..." echo "navigating to ../tmp/ ..."
mkdir -p ../data mkdir -p ../tmp
cd ../data/ cd ../tmp/
else else
# check if is valid directory # check if is valid directory
if [ ! -d $1 ]; then if [ ! -d $1 ]; then
@ -51,10 +51,10 @@ start=`date +%s`
# handle optional download dir # handle optional download dir
if [ -z "$1" ] if [ -z "$1" ]
then then
# navigate to ~/data # navigate to ~/tmp
echo "navigating to ../data/ ..." echo "navigating to ../tmp/ ..."
mkdir -p ../data mkdir -p ../tmp
cd ../data/ cd ../tmp/
else else
# check if is valid directory # check if is valid directory
if [ ! -d $1 ]; then if [ ! -d $1 ]; then
@ -82,7 +82,7 @@ runtime=$((end-start))
echo "Completed in" $runtime "seconds" echo "Completed in" $runtime "seconds"
cd ../data cd ../tmp
echo "Spliting dataset..." echo "Spliting dataset..."
python3 - "$@" <<END python3 - "$@" <<END
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
@ -160,8 +160,8 @@ os.system('mkdir ../VOC/labels/train')
os.system('mkdir ../VOC/labels/val') os.system('mkdir ../VOC/labels/val')
import os import os
print(os.path.exists('../data/train.txt')) print(os.path.exists('../tmp/train.txt'))
f = open('../data/train.txt', 'r') f = open('../tmp/train.txt', 'r')
lines = f.readlines() lines = f.readlines()
for line in lines: for line in lines:
@ -171,8 +171,8 @@ for line in lines:
if (os.path.exists("../" + line[:-1])): if (os.path.exists("../" + line[:-1])):
os.system("cp ../"+ line[:-1] + " ../VOC/images/train") os.system("cp ../"+ line[:-1] + " ../VOC/images/train")
print(os.path.exists('../data/train.txt')) print(os.path.exists('../tmp/train.txt'))
f = open('../data/train.txt', 'r') f = open('../tmp/train.txt', 'r')
lines = f.readlines() lines = f.readlines()
for line in lines: for line in lines:
@ -184,8 +184,8 @@ for line in lines:
if (os.path.exists("../" + line[:-1])): if (os.path.exists("../" + line[:-1])):
os.system("cp ../"+ line[:-1] + " ../VOC/labels/train") os.system("cp ../"+ line[:-1] + " ../VOC/labels/train")
print(os.path.exists('../data/2007_test.txt')) print(os.path.exists('../tmp/2007_test.txt'))
f = open('../data/2007_test.txt', 'r') f = open('../tmp/2007_test.txt', 'r')
lines = f.readlines() lines = f.readlines()
for line in lines: for line in lines:
@ -195,8 +195,8 @@ for line in lines:
if (os.path.exists("../" + line[:-1])): if (os.path.exists("../" + line[:-1])):
os.system("cp ../"+ line[:-1] + " ../VOC/images/val") os.system("cp ../"+ line[:-1] + " ../VOC/images/val")
print(os.path.exists('../data/2007_test.txt')) print(os.path.exists('../tmp/2007_test.txt'))
f = open('../data/2007_test.txt', 'r') f = open('../tmp/2007_test.txt', 'r')
lines = f.readlines() lines = f.readlines()
for line in lines: for line in lines:
@ -210,4 +210,5 @@ for line in lines:
END END
rm -rf ../data rm -rf ../tmp # remove temporary directory
echo "VOC download done."

Loading…
Cancel
Save