File size: 1,860 Bytes
205a7af |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
import resource
from pathlib import Path
from pprint import pprint
import matplotlib.pyplot as plt
import torch
from omegaconf import OmegaConf
from siclib.eval.io import get_eval_parser, parse_eval_args
from siclib.eval.simple_pipeline import SimplePipeline
from siclib.settings import EVAL_PATH
# flake8: noqa
# mypy: ignore-errors
rlimit = resource.getrlimit(resource.RLIMIT_NOFILE)
resource.setrlimit(resource.RLIMIT_NOFILE, (4096, rlimit[1]))
torch.set_grad_enabled(False)
class OpenPanoRadial(SimplePipeline):
default_conf = {
"data": {
"name": "simple_dataset",
"dataset_dir": "data/poly+maps+laval/pano_dataset_distorted",
"augmentations": {"name": "identity"},
"preprocessing": {"resize": 320, "edge_divisible_by": 32},
"test_batch_size": 1,
},
"model": {},
"eval": {
"thresholds": [1, 5, 10],
"pixel_thresholds": [0.5, 1, 3, 5],
"num_vis": 10,
"verbose": True,
},
"url": None,
}
if __name__ == "__main__":
dataset_name = Path(__file__).stem
parser = get_eval_parser()
args = parser.parse_intermixed_args()
default_conf = OmegaConf.create(OpenPanoRadial.default_conf)
# mingle paths
output_dir = Path(EVAL_PATH, dataset_name)
output_dir.mkdir(exist_ok=True, parents=True)
name, conf = parse_eval_args(dataset_name, args, "configs/", default_conf)
experiment_dir = output_dir / name
experiment_dir.mkdir(exist_ok=True)
pipeline = OpenPanoRadial(conf)
s, f, r = pipeline.run(
experiment_dir,
overwrite=args.overwrite,
overwrite_eval=args.overwrite_eval,
)
pprint(s)
if args.plot:
for name, fig in f.items():
fig.canvas.manager.set_window_title(name)
plt.show()
|