Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.

Commit f2f3f9e

Browse files
committed
fix get_sbd
1 parent d900f39 commit f2f3f9e

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

chainercv/datasets/sbd/sbd_utils.py

+20-21
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,7 @@
1010
train_voc2012_url = 'http://home.bharathh.info/pubs/codes/SBD/train_noval.txt'
1111

1212

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):
3414
with open(os.path.join(base_path, 'train.txt'), 'r') as f:
3515
train_ids = f.read().split('\n')[:-1]
3616
with open(os.path.join(base_path, 'val.txt'), 'r') as f:
@@ -46,6 +26,25 @@ def generate_voc2012_txt(base_path):
4626
f.write('\n'.join(sorted(all_ids)))
4727

4828

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+
4948
sbd_instance_segmentation_label_names = (
5049
'background',
5150
'aeroplane',

0 commit comments

Comments
 (0)