Browse Source

Fix relative path for VOC download (#880)

Cleaned up code
5.0
NanoCode012 GitHub 4 years ago
parent
commit
901243c780
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 30 deletions
  1. +11
    -30
      data/scripts/get_voc.sh

+ 11
- 30
data/scripts/get_voc.sh View File

lines = f.readlines() lines = f.readlines()


for line in lines: for line in lines:
#print(line.split('/')[-1][:-1])
line = "/".join(line.split('/')[2:])
#print(line)
if (os.path.exists("../" + line[:-1])):
os.system("cp ../"+ line[:-1] + " ../VOC/images/train")
line = "/".join(line.split('/')[-5:]).strip()
if (os.path.exists("../" + line)):
os.system("cp ../"+ line + " ../VOC/images/train")
print(os.path.exists('../tmp/train.txt'))
f = open('../tmp/train.txt', 'r')
lines = f.readlines()

for line in lines:
#print(line.split('/')[-1][:-1])
line = "/".join(line.split('/')[2:])
line = line.replace('JPEGImages', 'labels') line = line.replace('JPEGImages', 'labels')
line = line.replace('jpg', 'txt') line = line.replace('jpg', 'txt')
#print(line)
if (os.path.exists("../" + line[:-1])):
os.system("cp ../"+ line[:-1] + " ../VOC/labels/train")
if (os.path.exists("../" + line)):
os.system("cp ../"+ line + " ../VOC/labels/train")


print(os.path.exists('../tmp/2007_test.txt'))
f = open('../tmp/2007_test.txt', 'r')
lines = f.readlines()

for line in lines:
#print(line.split('/')[-1][:-1])
line = "/".join(line.split('/')[2:])
if (os.path.exists("../" + line[:-1])):
os.system("cp ../"+ line[:-1] + " ../VOC/images/val")


print(os.path.exists('../tmp/2007_test.txt')) print(os.path.exists('../tmp/2007_test.txt'))
f = open('../tmp/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:
#print(line.split('/')[-1][:-1])
line = "/".join(line.split('/')[2:])
line = "/".join(line.split('/')[-5:]).strip()
if (os.path.exists("../" + line)):
os.system("cp ../"+ line + " ../VOC/images/val")
line = line.replace('JPEGImages', 'labels') line = line.replace('JPEGImages', 'labels')
line = line.replace('jpg', 'txt') line = line.replace('jpg', 'txt')
#print(line)
if (os.path.exists("../" + line[:-1])):
os.system("cp ../"+ line[:-1] + " ../VOC/labels/val")
if (os.path.exists("../" + line)):
os.system("cp ../"+ line + " ../VOC/labels/val")


END END



Loading…
Cancel
Save