10
10
train_voc2012_url = 'http://home.bharathh.info/pubs/codes/SBD/train_noval.txt'
11
11
12
12
13
- def get_sbd ():
14
- data_root = download .get_dataset_directory (root )
15
- base_path = os .path .join (data_root , 'benchmark_RELEASE/dataset' )
16
- train_voc2012_file = os .path .join (base_path , 'train_voc2012.txt' )
17
- if not os .path .exists (train_voc2012_file ):
18
- six .moves .urllib .request .urlretrieve (
19
- train_voc2012_url , train_voc2012_file )
20
-
21
- if os .path .exists (os .path .join (base_path , 'train.txt' )):
22
- # skip downloading
23
- return base_path
24
-
25
- download_file_path = utils .cached_download (url )
26
- ext = os .path .splitext (url )[1 ]
27
- utils .extractall (download_file_path , data_root , ext )
28
- generate_voc2012_txt (base_path )
29
-
30
- return base_path
31
-
32
-
33
- def generate_voc2012_txt (base_path ):
13
+ def _generate_voc2012_txt (base_path ):
34
14
with open (os .path .join (base_path , 'train.txt' ), 'r' ) as f :
35
15
train_ids = f .read ().split ('\n ' )[:- 1 ]
36
16
with open (os .path .join (base_path , 'val.txt' ), 'r' ) as f :
@@ -46,6 +26,25 @@ def generate_voc2012_txt(base_path):
46
26
f .write ('\n ' .join (sorted (all_ids )))
47
27
48
28
29
+ def get_sbd ():
30
+ data_root = download .get_dataset_directory (root )
31
+ base_path = os .path .join (data_root , 'benchmark_RELEASE/dataset' )
32
+
33
+ train_voc2012_file = os .path .join (base_path , 'train_voc2012.txt' )
34
+ if os .path .exists (train_voc2012_file ):
35
+ # skip downloading
36
+ return base_path
37
+
38
+ download_file_path = utils .cached_download (url )
39
+ ext = os .path .splitext (url )[1 ]
40
+ utils .extractall (download_file_path , data_root , ext )
41
+
42
+ six .moves .urllib .request .urlretrieve (train_voc2012_url , train_voc2012_file )
43
+ _generate_voc2012_txt (base_path )
44
+
45
+ return base_path
46
+
47
+
49
48
sbd_instance_segmentation_label_names = (
50
49
'background' ,
51
50
'aeroplane' ,
0 commit comments