Skip to content

Add crestereo dataset #6269

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

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cad18a4
Added Stereo Matching dataset interface and several classic datasets.
TeodorPoncu Jul 10, 2022
df6ec4b
added SceneFlow, FallingThings and CREStereo
TeodorPoncu Jul 11, 2022
d0c5afb
added SceneFlow, FallingThings and CREStereo
TeodorPoncu Jul 11, 2022
a566475
"removed duplicate folder"
TeodorPoncu Jul 11, 2022
8ea74f2
Added InStereo2k. Started working on dataset tests
TeodorPoncu Jul 13, 2022
0959499
"Added calibrartion arg for Middlebury2014 (#6259)"
TeodorPoncu Jul 13, 2022
a9365fe
"Fixed test calibration test Middlebury2014 (#6259)"
TeodorPoncu Jul 13, 2022
96c7bf4
Clean-up. Disp map format to (C, H, W) & valid mask to (H, W). (#6259)
TeodorPoncu Jul 14, 2022
bbb1c56
Ran ufmt. (#6259)
TeodorPoncu Jul 14, 2022
669611e
Adressed CI/CD errors
TeodorPoncu Jul 14, 2022
d9d17a8
Ran formatting pre-commit hook
TeodorPoncu Jul 14, 2022
a31ee83
Added Stereo Matching dataset interface and several classic datasets.
TeodorPoncu Jul 10, 2022
4a5ac89
added SceneFlow, FallingThings and CREStereo
TeodorPoncu Jul 11, 2022
a1fc699
added SceneFlow, FallingThings and CREStereo
TeodorPoncu Jul 11, 2022
62368b1
"removed duplicate folder"
TeodorPoncu Jul 11, 2022
33c52a5
Added InStereo2k. Started working on dataset tests
TeodorPoncu Jul 13, 2022
2deab62
"Added calibrartion arg for Middlebury2014 (#6259)"
TeodorPoncu Jul 13, 2022
cbc55f3
"Fixed test calibration test Middlebury2014 (#6259)"
TeodorPoncu Jul 13, 2022
0759706
Clean-up. Disp map format to (C, H, W) & valid mask to (H, W). (#6259)
TeodorPoncu Jul 14, 2022
de94c2c
Ran ufmt. (#6259)
TeodorPoncu Jul 14, 2022
4256ca4
Adressed CI/CD errors
TeodorPoncu Jul 14, 2022
d7882ca
Ran formatting pre-commit hook
TeodorPoncu Jul 14, 2022
f8d1228
Merge branch 'add-crestereo-dataset' of https://github.com/pytorch/vi…
TeodorPoncu Jul 14, 2022
1436d64
Merge branch 'main' of https://github.com/pytorch/vision into add-cre…
TeodorPoncu Jul 14, 2022
5f291c2
Added reusable _pfm_read. Addressed CI issues.
TeodorPoncu Jul 14, 2022
af6b343
Removed duplicate test code for stereo dataset testcases
TeodorPoncu Jul 14, 2022
67eacf2
Removed string replaces. Moved pattern matching in parent class.
TeodorPoncu Jul 14, 2022
07e0067
Addressed doc comments
TeodorPoncu Jul 14, 2022
ec550e8
Middlebury disparity quickfix
TeodorPoncu Jul 14, 2022
1dd1753
Fixed mypy errors. Addressed download checks.
TeodorPoncu Jul 14, 2022
9f70687
Dataset renaming. Test changes. getitem removed. Warnings removed. Mi…
TeodorPoncu Jul 15, 2022
78f4a52
Forced disparity to be positive
TeodorPoncu Jul 15, 2022
1baaaef
Merge branch 'main' into add-crestereo-dataset
TeodorPoncu Jul 15, 2022
e2ad8d2
Removed implicit mask creation. Added private built_in_mask flag simi…
TeodorPoncu Jul 18, 2022
71343fe
Merge branch 'add-crestereo-dataset' of https://github.com/pytorch/vi…
TeodorPoncu Jul 18, 2022
93f4b6c
Added getiem & docs to inform support multi shape returns
TeodorPoncu Jul 18, 2022
c83bc80
removed path returns from helper test functions
TeodorPoncu Jul 19, 2022
650bf67
replaced os.path.join with pathlib in tests
TeodorPoncu Jul 19, 2022
39efae5
crestereo draft implementation
TeodorPoncu Jul 25, 2022
ce66e4c
Merging from training prototyping
TeodorPoncu Jul 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions test/datasets_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
from collections import defaultdict
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Tuple, Union

import numpy as np
import PIL
import PIL.Image
import pytest
import torch
import torchvision.datasets
import torchvision.io
from common_utils import get_tmp_dir, disable_console_output

from torchvision.transforms.functional import get_dimensions

__all__ = [
"UsageError",
Expand Down Expand Up @@ -561,7 +562,9 @@ def test_feature_types(self, config):
@test_all_configs
def test_num_examples(self, config):
with self.create_dataset(config) as (dataset, info):
assert len(dataset) == info["num_examples"]
assert (
len(dataset) == info["num_examples"]
), f"The number of examples {len(dataset)} does not match the expected {info['num_examples']}"

@test_all_configs
def test_transforms(self, config):
Expand Down Expand Up @@ -931,6 +934,48 @@ def create_random_string(length: int, *digits: str) -> str:
return "".join(random.choice(digits) for _ in range(length))


def shape_test_for_stereo_gt_w_mask(
left: PIL.Image.Image, right: PIL.Image.Image, disparity: np.ndarray, valid_mask: np.ndarray
):
left_dims = get_dimensions(left)
right_dims = get_dimensions(right)
c, h, w = left_dims
# check that left and right are the same size
assert left_dims == right_dims
# check general shapes
assert c == 3
assert disparity.ndim == 3
assert disparity.shape == (1, h, w)
# check that valid mask is the same size as the disparity
_, dh, dw = disparity.shape
mh, mw = valid_mask.shape
assert dh == mh
assert dw == mw


def shape_test_for_stereo_gt_no_mask(left: PIL.Image.Image, right: PIL.Image.Image, disparity: np.ndarray):
left_dims = get_dimensions(left)
right_dims = get_dimensions(right)
c, h, w = left_dims
# check that left and right are the same size
assert left_dims == right_dims
# check general shapes
assert c == 3
assert disparity.ndim == 3
assert disparity.shape == (1, h, w)


def shape_test_for_stereo_no_gt(left: PIL.Image.Image, right: PIL.Image.Image, disparity: None):
left_dims = get_dimensions(left)
right_dims = get_dimensions(right)
c, _, _ = left_dims
# check that left and right are the same size
assert left_dims == right_dims
# check general shapes
assert c == 3
assert disparity is None


def make_fake_pfm_file(h, w, file_name):
values = list(range(3 * h * w))
# Note: we pack everything in little endian: -1.0, and "<"
Expand Down
Loading