ramdrop / stun

Implementation for the paper: STUN: Self-Teaching Uncertainty Estimation for Place Recognition
BSD 3-Clause "New" or "Revised" License
30 stars 3 forks source link

About function update_opt_from_json #2

Closed wpumain closed 1 year ago

wpumain commented 1 year ago

The function [update_opt_from_json] is to exclude some parameters that need to be manually updated, and then used to update other parameters with the same name as the command line parameters but different from the default value of the command line。right?

What does this line of code do? https://github.com/ramdrop/stun/blob/0414dec2715d69d83b8a87b5d612a2b6a9fe54af/options.py#L69

ramdrop commented 1 year ago

You are right.

If the act.const attribute is a boolean value, it means that the corresponding argument is a boolean flag (i.e., a flag that takes no argument), and the expression type(act.const) == type(True) will evaluate to True. In this case, the code is checking whether the value of the stored flag matches the default value of the argument. If it does, the corresponding flag is added to the to_del list, because boolean flags do not accept arguments. If it doesn't, the value of the flag in stored_flags is set to an empty string.