facebookresearch / OrienterNet

Source Code for Paper "OrienterNet Visual Localization in 2D Public Maps with Neural Matching"
Other
463 stars 48 forks source link

A small bug #28

Closed basbaba closed 1 year ago

basbaba commented 1 year ago

in maploc.data.mapillary.prepare.py line 255:

shots_out = [(i, s) for i, ss in enumerate(shots_out) for s in ss if ss is not None]

if ss is None, this code will raise error, after modified into:

shots_out = [(i, s) for i, ss in enumerate(shots_out) if ss is not None for s in ss]

that will be ok

A small sample will show this problem:

a = [[1,2,3],[4,5,6],None,[7,8,9]] b = [vi for i,v in enumerate(a) for vi in v if v is not None]

Traceback (most recent call last): File "", line 1, in File "", line 1, in

b = [vi for i,v in enumerate(a) if v is not None for vi in v] b [1, 2, 3, 4, 5, 6, 7, 8, 9]

basbaba commented 1 year ago

and an other one is in the same file at line: 314:

for i, info in image_infos.items(): seq_to_image_ids[info["sequence"]].append(i)

few json file of image_infos only contains a 'null' string, that leads to info["sequence"] into a None object. so I modified this as:

' for i, info in image_infos.items(): if info is not None: seq_to_image_ids[info["sequence"]].append(i)'

this happened in: sanfrancisco_soma/image_infos/483044940169411.json sanfrancisco_hayes/image_infos/184242780434835.json

sarlinpe commented 1 year ago

Thanks a lot! The second bug is actually more subtle. Fixed in https://github.com/facebookresearch/OrienterNet/pull/29.

basbaba commented 1 year ago

Hi Sarlinpe: Another small problem at maploc/traing.py line 119: init_checkpoint_path = cfg.training.get("finetune_from_checkpoint")

this should be: init_checkpoint_path = Path(cfg.training.get("finetune_from_checkpoint")) because the module.py -> load_from_checkpoint() need a pathlib.Path parameter