forked from lidc54/SSD_data_augment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
link.py
53 lines (43 loc) · 1.27 KB
/
link.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#
import os
from xmlSet import mainFunction
from Transform import *
from scipy.misc import imread
def linkImgAnn(cp):
data, ann = cp
dataDir = '/'.join(data.split('/')[0:2])
annDir = '/'.join(ann.split('/')[0:2])
extend = '_Aug'
def readFile():
testFile = '/home/flag54/Downloads/caffe-ssd/data/VOC0712/trainval.txt'
for bond in open(testFile):
both = bond.split()
yield both
'''
if os.path.exists(both[0]) and os.path.exists(both[1]) :
linkImgANN(both)
'''
def readAnnoImage():
prex = "/home/flag54/Downloads/caffe-ssd/data/VOCdevkit/"
# read xmlAnno
couples = readFile()
xx = (1,)
for cp in couples:
try:
img, anno = cp
print prex + img,
if img=='VOC2012/JPEGImages/2009_002851.jpg':
print 'oo'
data, labels, origin_data = mainFunction(prex + img, prex + anno)
tmp = []
for i in labels.keys():
tmp.append(labels[i]['name'])
xx += tuple(tmp)
# print 'o'
###deal with data & its labels
# show_data(data, labels)
except Exception, e:
print 'line:', e
print xx
if __name__ == "__main__":
readAnnoImage()