From 4a5c3714eaec33628259dd3c481f3d36597e0c58 Mon Sep 17 00:00:00 2001 From: wanghaoshuang Date: Thu, 13 Jul 2017 15:10:25 +0800 Subject: [PATCH] fix python dependency for voc2012 dataset --- python/paddle/v2/dataset/voc_seg.py | 10 ++++++---- python/setup.py.in | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/python/paddle/v2/dataset/voc_seg.py b/python/paddle/v2/dataset/voc_seg.py index 0df4423ff04..617e212d67f 100644 --- a/python/paddle/v2/dataset/voc_seg.py +++ b/python/paddle/v2/dataset/voc_seg.py @@ -22,7 +22,7 @@ with segmentation has been increased from 7,062 to 9,993. import tarfile import io import numpy as np -from common import download +from paddle.v2.dataset.common import download from paddle.v2.image import * from PIL import Image @@ -36,6 +36,8 @@ SET_FILE = 'VOCdevkit/VOC2012/ImageSets/Segmentation/{}.txt' DATA_FILE = 'VOCdevkit/VOC2012/JPEGImages/{}.jpg' LABEL_FILE = 'VOCdevkit/VOC2012/SegmentationClass/{}.png' +CACHE_DIR = 'voc2012' + def reader_creator(filename, sub_name): @@ -66,18 +68,18 @@ def train(): """ Create a train dataset reader containing 2913 images in HWC order. """ - return reader_creator(download(VOC_URL, 'voc_seg', VOC_MD5), 'trainval') + return reader_creator(download(VOC_URL, CACHE_DIR, VOC_MD5), 'trainval') def test(): """ Create a test dataset reader containing 1464 images in HWC order. """ - return reader_creator(download(VOC_URL, 'voc_seg', VOC_MD5), 'train') + return reader_creator(download(VOC_URL, CACHE_DIR, VOC_MD5), 'train') def val(): """ Create a val dataset reader containing 1449 images in HWC order. """ - return reader_creator(download(VOC_URL, 'voc_seg', VOC_MD5), 'val') + return reader_creator(download(VOC_URL, CACHE_DIR, VOC_MD5), 'val') diff --git a/python/setup.py.in b/python/setup.py.in index 271ee6e5526..310ac403a98 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -19,7 +19,8 @@ setup_requires=["requests", "recordio", "matplotlib", "rarfile", - "scipy>=0.19.0"] + "scipy>=0.19.0", + "Pillow"] if '${CMAKE_SYSTEM_PROCESSOR}' not in ['arm', 'armv7-a', 'aarch64']: setup_requires+=["opencv-python"] -- GitLab