提交 4a5c3714 编写于 作者: W wanghaoshuang

fix python dependency for voc2012 dataset

上级 24376310
...@@ -22,7 +22,7 @@ with segmentation has been increased from 7,062 to 9,993. ...@@ -22,7 +22,7 @@ with segmentation has been increased from 7,062 to 9,993.
import tarfile import tarfile
import io import io
import numpy as np import numpy as np
from common import download from paddle.v2.dataset.common import download
from paddle.v2.image import * from paddle.v2.image import *
from PIL import Image from PIL import Image
...@@ -36,6 +36,8 @@ SET_FILE = 'VOCdevkit/VOC2012/ImageSets/Segmentation/{}.txt' ...@@ -36,6 +36,8 @@ SET_FILE = 'VOCdevkit/VOC2012/ImageSets/Segmentation/{}.txt'
DATA_FILE = 'VOCdevkit/VOC2012/JPEGImages/{}.jpg' DATA_FILE = 'VOCdevkit/VOC2012/JPEGImages/{}.jpg'
LABEL_FILE = 'VOCdevkit/VOC2012/SegmentationClass/{}.png' LABEL_FILE = 'VOCdevkit/VOC2012/SegmentationClass/{}.png'
CACHE_DIR = 'voc2012'
def reader_creator(filename, sub_name): def reader_creator(filename, sub_name):
...@@ -66,18 +68,18 @@ def train(): ...@@ -66,18 +68,18 @@ def train():
""" """
Create a train dataset reader containing 2913 images in HWC order. 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(): def test():
""" """
Create a test dataset reader containing 1464 images in HWC order. 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(): def val():
""" """
Create a val dataset reader containing 1449 images in HWC order. 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')
...@@ -19,7 +19,8 @@ setup_requires=["requests", ...@@ -19,7 +19,8 @@ setup_requires=["requests",
"recordio", "recordio",
"matplotlib", "matplotlib",
"rarfile", "rarfile",
"scipy>=0.19.0"] "scipy>=0.19.0",
"Pillow"]
if '${CMAKE_SYSTEM_PROCESSOR}' not in ['arm', 'armv7-a', 'aarch64']: if '${CMAKE_SYSTEM_PROCESSOR}' not in ['arm', 'armv7-a', 'aarch64']:
setup_requires+=["opencv-python"] setup_requires+=["opencv-python"]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册