Spaces:
Runtime error
Runtime error
Modify Mapillary processing config from CLI
Browse files
maploc/data/mapillary/prepare.py
CHANGED
|
@@ -132,7 +132,7 @@ location_to_params = {
|
|
| 132 |
}
|
| 133 |
|
| 134 |
|
| 135 |
-
|
| 136 |
{
|
| 137 |
"max_image_size": 512,
|
| 138 |
"do_legacy_pano_offset": True,
|
|
@@ -277,6 +277,7 @@ def process_location(
|
|
| 277 |
data_dir: Path,
|
| 278 |
split_path: Path,
|
| 279 |
token: str,
|
|
|
|
| 280 |
generate_tiles: bool = False,
|
| 281 |
):
|
| 282 |
params = location_to_params[location]
|
|
@@ -393,10 +394,12 @@ if __name__ == "__main__":
|
|
| 393 |
"--data_dir", type=Path, default=MapillaryDataModule.default_cfg["data_dir"]
|
| 394 |
)
|
| 395 |
parser.add_argument("--generate_tiles", action="store_true")
|
|
|
|
| 396 |
args = parser.parse_args()
|
| 397 |
|
| 398 |
args.data_dir.mkdir(exist_ok=True, parents=True)
|
| 399 |
shutil.copy(Path(__file__).parent / args.split_filename, args.data_dir)
|
|
|
|
| 400 |
|
| 401 |
for location in args.locations:
|
| 402 |
logger.info("Starting processing for location %s.", location)
|
|
@@ -405,5 +408,6 @@ if __name__ == "__main__":
|
|
| 405 |
args.data_dir,
|
| 406 |
args.data_dir / args.split_filename,
|
| 407 |
args.token,
|
|
|
|
| 408 |
args.generate_tiles,
|
| 409 |
)
|
|
|
|
| 132 |
}
|
| 133 |
|
| 134 |
|
| 135 |
+
default_cfg = OmegaConf.create(
|
| 136 |
{
|
| 137 |
"max_image_size": 512,
|
| 138 |
"do_legacy_pano_offset": True,
|
|
|
|
| 277 |
data_dir: Path,
|
| 278 |
split_path: Path,
|
| 279 |
token: str,
|
| 280 |
+
cfg: DictConfig,
|
| 281 |
generate_tiles: bool = False,
|
| 282 |
):
|
| 283 |
params = location_to_params[location]
|
|
|
|
| 394 |
"--data_dir", type=Path, default=MapillaryDataModule.default_cfg["data_dir"]
|
| 395 |
)
|
| 396 |
parser.add_argument("--generate_tiles", action="store_true")
|
| 397 |
+
parser.add_argument("dotlist", nargs="*")
|
| 398 |
args = parser.parse_args()
|
| 399 |
|
| 400 |
args.data_dir.mkdir(exist_ok=True, parents=True)
|
| 401 |
shutil.copy(Path(__file__).parent / args.split_filename, args.data_dir)
|
| 402 |
+
cfg_ = OmegaConf.merge(default_cfg, OmegaConf.from_cli(args.dotlist))
|
| 403 |
|
| 404 |
for location in args.locations:
|
| 405 |
logger.info("Starting processing for location %s.", location)
|
|
|
|
| 408 |
args.data_dir,
|
| 409 |
args.data_dir / args.split_filename,
|
| 410 |
args.token,
|
| 411 |
+
cfg_,
|
| 412 |
args.generate_tiles,
|
| 413 |
)
|