-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Add Pascal VOC Class Segmentation #37
Conversation
torchvision/datasets/pascal.py
Outdated
|
||
def __getitem__(self, index): | ||
img = Image.open(self.images[index]).convert('RGB') | ||
target = Image.open(self.masks[index]).convert('RGB') |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torchvision/datasets/pascal.py
Outdated
if self.transform is not None: | ||
print("transform was not none") | ||
img = self.transform(img) | ||
# todo(bdd) : perhaps transformations should be applied differently to masks? |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torchvision/datasets/pascal.py
Outdated
return | ||
|
||
# downloads file | ||
if os.path.isfile(fpath) and \ |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torchvision/datasets/pascal.py
Outdated
self.masks = [] | ||
with open(os.path.join(split_f), "r") as lines: | ||
for line in lines: | ||
image = os.path.join(image_dir, line.rstrip('\n') + ".jpg") |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torchvision/datasets/pascal.py
Outdated
splits_dir = os.path.join(voc_root, 'ImageSets/Segmentation') | ||
split_f = os.path.join(splits_dir, 'train.txt') | ||
if not self.train: | ||
split_f = os.path.join(splits_dir, ' trainval.txt') |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Thanks for the PR!
I think we will need to figure out a better way of applying random transforms to both inputs and targets, as discussed in #9 . |
Thanks for the review, @fmassa. I have a few follow up questions while I wait for the other datasets to download...
|
Any updates on this? |
@j-min I'll be revisiting this PR before I release my implementation of Detectron. I'm currently in the cleanup process, |
Replaced by #663, thanks a lot for the original PR! |
./VOCdevkit/VOC2012/ImageSets/Segmentation/*.txt
CocoDetection
andCocoCaptions
. How aboutPascalSegmentation
?