Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazily evaluate the target_transform default argument. #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion data/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ class COCODetection(data.Dataset):
"""

def __init__(self, root, image_set='trainval35k', transform=None,
target_transform=COCOAnnotationTransform(), dataset_name='MS COCO'):
target_transform=None, dataset_name='MS COCO'):

if target_transform is None:
target_transform = COCOAnnotationTransform()

sys.path.append(osp.join(root, COCO_API))
from pycocotools.coco import COCO
self.root = osp.join(root, IMAGES, image_set)
Expand Down
6 changes: 5 additions & 1 deletion data/voc0712.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ class VOCDetection(data.Dataset):

def __init__(self, root,
image_sets=[('2007', 'trainval'), ('2012', 'trainval')],
transform=None, target_transform=VOCAnnotationTransform(),
transform=None, target_transform=None,
dataset_name='VOC0712'):

if target_transform is None:
target_transform = VOCAnnotationTransform()

self.root = root
self.image_set = image_sets
self.transform = transform
Expand Down