MengHsir commited on
Commit
dbc171a
·
verified ·
1 Parent(s): 839743f

upload 3RScan 数据集

Browse files
3DSGG/3RScan/auto_download.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ echo "确认下载3RScan数据集(约94GB)..."
3
+ # 使用printf来模拟用户输入
4
+ printf "\n" | python 3DSGG/3RScan/download_3RScan.py -o /data1/qinghao/SGG_data/3RScan_data
3DSGG/3RScan/down.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 创建一个新的自动下载脚本
2
+ cat > 3DSGG/3RScan/auto_download.sh << 'EOF'
3
+ #!/bin/bash
4
+ echo "确认下载3RScan数据集(约94GB)..."
5
+ # 使用printf来模拟用户输入
6
+ printf "\n" | python 3DSGG/3RScan/download_3RScan.py -o /data1/qinghao/SGG_data/3RScan_data
7
+ EOF
8
+
9
+ # 给脚本执行权限
10
+ chmod +x 3DSGG/3RScan/auto_download.sh
11
+
12
+ # 运行自动下载脚本
13
+ ./3DSGG/3RScan/auto_download.sh
3DSGG/3RScan/download_3RScan.py ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # Downloads 3RScan public data release
3
+
4
+ # The data is released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.
5
+ # Some useful info: Each scan is identified by a unique ID listed here:
6
+ # http://campar.in.tum.de/public_datasets/3RScan/scans.txt or https://github.com/WaldJohannaU/3RScan/tree/master/splits
7
+ #
8
+ # Script usage:
9
+ # - To download the entire 3RScan release: download.py -o [directory in which to download]
10
+ # - To download a specific scan (e.g., 19eda6f4-55aa-29a0-8893-8eac3a4d8193): download.py -o [directory in which to download] --id 19eda6f4-55aa-29a0-8893-8eac3a4d8193
11
+ # - To download the tfrecords: download.py -o [directory in which to download] --type=tfrecords
12
+ # - The corresponding metadata file is here: http://campar.in.tum.de/public_datasets/3RScan/3RScan.json
13
+ # - 3D semantic scene graphs for 3RScan are available for download on our project page https://3dssg.github.io
14
+
15
+ import sys
16
+ import argparse
17
+ import os
18
+
19
+ if sys.version_info.major >= 3 and sys.version_info.minor >= 6:
20
+ import urllib.request as urllib
21
+ else:
22
+ import urllib
23
+ import tempfile
24
+ import re
25
+
26
+ BASE_URL = 'http://campar.in.tum.de/public_datasets/3RScan/'
27
+ DATA_URL = BASE_URL + 'Dataset/'
28
+ TOS_URL = 'http://campar.in.tum.de/public_datasets/3RScan/3RScanTOU.pdf'
29
+ TEST_FILETYPES = ['mesh.refined.v2.obj', 'mesh.refined.mtl', 'mesh.refined_0.png', 'sequence.zip']
30
+ # We only provide semantic annotations for the train and validation scans as well as the for the
31
+ # reference scans in the test set.
32
+ FILETYPES = TEST_FILETYPES + ['labels.instances.annotated.v2.ply', 'mesh.refined.0.010000.segs.v2.json', 'semseg.v2.json']
33
+
34
+ RELEASE = 'release_scans.txt'
35
+ HIDDEN_RELEASE = 'test_rescans.txt'
36
+
37
+ RELEASE_SIZE = '~94GB'
38
+ id_reg = re.compile(r"[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}")
39
+
40
+ def get_scans(scan_file):
41
+ scan_lines = urllib.urlopen(scan_file)
42
+ scans = []
43
+ for scan_line in scan_lines:
44
+ scan_line = scan_line.decode('utf8').rstrip('\n')
45
+ match = id_reg.search(scan_line)
46
+ if match:
47
+ scan_id = match.group()
48
+ scans.append(scan_id)
49
+ return scans
50
+
51
+ def download_release(release_scans, out_dir, file_types):
52
+ print('Downloading 3RScan release to ' + out_dir + '...')
53
+ for scan_id in release_scans:
54
+ scan_out_dir = os.path.join(out_dir, scan_id)
55
+ download_scan(scan_id, scan_out_dir, file_types)
56
+ print('Downloaded 3RScan release.')
57
+
58
+ def download_file(url, out_file):
59
+ print(url)
60
+ out_dir = os.path.dirname(out_file)
61
+ if not os.path.isdir(out_dir):
62
+ os.makedirs(out_dir)
63
+ if not os.path.isfile(out_file):
64
+ print('\t' + url + ' > ' + out_file)
65
+ fh, out_file_tmp = tempfile.mkstemp(dir=out_dir)
66
+ f = os.fdopen(fh, 'w')
67
+ f.close()
68
+ urllib.urlretrieve(url, out_file_tmp)
69
+ os.rename(out_file_tmp, out_file)
70
+ else:
71
+ print('WARNING: skipping download of existing file ' + out_file)
72
+
73
+ def download_scan(scan_id, out_dir, file_types):
74
+ print('Downloading 3RScan scan ' + scan_id + ' ...')
75
+ if not os.path.isdir(out_dir):
76
+ os.makedirs(out_dir)
77
+ for ft in file_types:
78
+ url = DATA_URL + '/' + scan_id + '/' + ft
79
+ out_file = out_dir + '/' + ft
80
+ download_file(url, out_file)
81
+ print('Downloaded scan ' + scan_id)
82
+
83
+ def download_tfrecord(url, out_dir, file):
84
+ if not os.path.isdir(out_dir):
85
+ os.makedirs(out_dir)
86
+ out_file = os.path.join(out_dir, file)
87
+ download_file(url + '/' + file, out_file)
88
+
89
+
90
+ def main():
91
+ parser = argparse.ArgumentParser(description='Downloads 3RScan public data release.')
92
+ parser.add_argument('-o', '--out_dir', required=True, help='directory in which to download')
93
+ parser.add_argument('--id', help='specific scan id to download')
94
+ parser.add_argument('--type', help='specific file type to download')
95
+ args = parser.parse_args()
96
+
97
+ print('By pressing any key to continue you confirm that you have agreed to the 3RScan terms of use as described at:')
98
+ print(TOS_URL)
99
+ print('***')
100
+ print('Press any key to continue, or CTRL-C to exit.')
101
+
102
+ release_scans = get_scans(BASE_URL + RELEASE)
103
+ test_scans = get_scans(BASE_URL + HIDDEN_RELEASE)
104
+ file_types = FILETYPES;
105
+ file_types_test = TEST_FILETYPES;
106
+
107
+ if args.type: # download file type
108
+ file_type = args.type
109
+ if file_type == 'tfrecords':
110
+ download_tfrecord(BASE_URL, args.out_dir, 'val-scans.tfrecords')
111
+ download_tfrecord(BASE_URL, args.out_dir, 'train-scans.tfrecords')
112
+ return
113
+ elif file_type not in FILETYPES:
114
+ print('ERROR: Invalid file type: ' + file_type)
115
+ return
116
+ file_types = [file_type]
117
+ if file_type not in TEST_FILETYPES:
118
+ file_types_test = []
119
+ else:
120
+ file_types_test = [file_type]
121
+ if args.id: # download single scan
122
+ scan_id = args.id
123
+ if scan_id not in release_scans and scan_id not in test_scans:
124
+ print('ERROR: Invalid scan id: ' + scan_id)
125
+ else:
126
+ out_dir = os.path.join(args.out_dir, scan_id)
127
+
128
+ if scan_id in release_scans:
129
+ download_scan(scan_id, out_dir, file_types)
130
+ elif scan_id in test_scans:
131
+ download_scan(scan_id, out_dir, file_types_test)
132
+ else: # download entire release
133
+ if len(file_types) == len(FILETYPES):
134
+ print('WARNING: You are downloading the entire 3RScan release which requires ' + RELEASE_SIZE + ' of space.')
135
+ else:
136
+ print('WARNING: You are downloading all 3RScan scans of type ' + file_types[0])
137
+ print('Note that existing scan directories will be skipped. Delete partially downloaded directories to re-download.')
138
+ print('***')
139
+ print('Press any key to continue, or CTRL-C to exit.')
140
+ key = input('')
141
+ download_release(release_scans, args.out_dir, file_types)
142
+ download_release(test_scans, args.out_dir, file_types_test)
143
+
144
+ if __name__ == "__main__": main()
3DSGG/3RScan/下载页面.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ 提交表格后跳转地址:https://gist.github.com/WaldJohannaU/55f5e35992ea91157b789b15eac4d432#file-download-3rscan-L142
2
+
3
+
4
+
5
+