| 2908 | FEATURE_TYPES = (PIL.Image.Image, PIL.Image.Image, (np.ndarray, type(None)), (np.ndarray, type(None))) |
| 2909 | |
| 2910 | def inject_fake_data(self, tmpdir, config): |
| 2911 | kitti_dir = pathlib.Path(tmpdir) / "Kitti2012" |
| 2912 | os.makedirs(kitti_dir, exist_ok=True) |
| 2913 | |
| 2914 | split_dir = kitti_dir / (config["split"] + "ing") |
| 2915 | os.makedirs(split_dir, exist_ok=True) |
| 2916 | |
| 2917 | num_examples = {"train": 4, "test": 3}.get(config["split"], 0) |
| 2918 | |
| 2919 | datasets_utils.create_image_folder( |
| 2920 | root=split_dir, |
| 2921 | name="colored_0", |
| 2922 | file_name_fn=lambda i: f"{i:06d}_10.png", |
| 2923 | num_examples=num_examples, |
| 2924 | size=(3, 100, 200), |
| 2925 | ) |
| 2926 | datasets_utils.create_image_folder( |
| 2927 | root=split_dir, |
| 2928 | name="colored_1", |
| 2929 | file_name_fn=lambda i: f"{i:06d}_10.png", |
| 2930 | num_examples=num_examples, |
| 2931 | size=(3, 100, 200), |
| 2932 | ) |
| 2933 | |
| 2934 | if config["split"] == "train": |
| 2935 | datasets_utils.create_image_folder( |
| 2936 | root=split_dir, |
| 2937 | name="disp_noc", |
| 2938 | file_name_fn=lambda i: f"{i:06d}.png", |
| 2939 | num_examples=num_examples, |
| 2940 | # Kitti2012 uses a single channel image for disparities |
| 2941 | size=(1, 100, 200), |
| 2942 | ) |
| 2943 | |
| 2944 | return num_examples |
| 2945 | |
| 2946 | def test_train_splits(self): |
| 2947 | for split in ["train"]: |