-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdataload.py
60 lines (52 loc) · 1.53 KB
/
dataload.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
54
55
56
57
58
59
60
import pandas as pd
import os
"""
imgs = os.listdir('test/RGB')
CMimgs = os.listdir("test/CM_gt")
EMimgs = os.listdir("test/EM_gt")
corlabs = os.listdir("test/corner_labels")
imgpaths = []
CMpaths = []
EMpaths = []
corlabpaths=[]
root=""
#abspth = os.path.abspath(root)
for img in imgs:
pths = os.path.join(root,"test/RGB/",img)
imgpaths.append(pths)
for CMimg in CMimgs:
pths = os.path.join(root,"test/CM_gt/",CMimg)
CMpaths.append(pths)
for EMimg in EMimgs:
pths = os.path.join(root,"test/EM_gt/",EMimg)
EMpaths.append(pths)
for corlab in corlabs:
pths = os.path.join(root,"test/corner_labels/",corlab)
corlabpaths.append(pths)
dict={'images' : imgpaths, 'EM' : EMpaths, 'CM' : CMpaths, 'CL' : corlabpaths}
df = pd.DataFrame(data = dict)
df.to_json("testdata.json")
"""
cornerimages = os.listdir("train/morethan4corners")
corners=[]
for item in cornerimages:
item=item.split('_')
name= item[0]+'_'+item[1]
corners.append(name)
imgpaths = []
CMpaths = []
EMpaths = []
corlabpaths=[]
root=""
for img in corners:
pths = os.path.join(root,"train/RGB/",img+".jpg")
imgpaths.append(pths)
pths = os.path.join(root,"train/CM_gt/",img+"_CM.jpg")
CMpaths.append(pths)
pths = os.path.join(root,"train/EM_gt/",img+"_EM.jpg")
EMpaths.append(pths)
pths = os.path.join(root,"train/corner_labels/",img+".txt")
corlabpaths.append(pths)
dict={'images' : imgpaths, 'EM' : EMpaths, 'CM' : CMpaths, 'CL' : corlabpaths}
df = pd.DataFrame(data = dict)
df.to_json("morethan4corners.json")