tbp.monty.frameworks.models.salience#
tbp.monty.frameworks.models.salience.on_object_observation#
- class OnObjectObservation(center_location: np.ndarray | None, locations: np.ndarray, salience: np.ndarray) None[source]#
Bases:
object- center_location: np.ndarray | None#
- locations: np.ndarray#
- salience: np.ndarray#
- on_object_observation(raw_observation: dict, salience_map: numpy.ndarray) OnObjectObservation[source]#
Convert all raw observation data into image format.
This function reformats the arrays in a raw observations dictionary so that they’re all indexable by image row and column indices. It also splits the semantic_3d array into 3D locations and an on-object/surface indicator array.
- Parameters:
- Return type:
- Returns:
The grid/matrix formatted (unraveled) on-object salience and location data, along with the location corresponding to the central pixel.
tbp.monty.frameworks.models.salience.return_inhibitor#
- class DecayField(kernel_factory_class: type[DecayKernelFactory] = <class 'tbp.monty.frameworks.models.salience.return_inhibitor.DecayKernelFactory'>, kernel_factory_args: dict[str, Any] | None = None)[source]#
Bases:
objectManages a collection of decay kernels.
- __init__(kernel_factory_class=<class 'tbp.monty.frameworks.models.salience.return_inhibitor.DecayKernelFactory'>, kernel_factory_args=None)[source]#
- add(location: numpy.ndarray) None[source]#
Add a kernel to the field.
- Return type:
- compute_weights(points: numpy.ndarray) numpy.ndarray[source]#
- Return type:
- class DecayKernel(location: np.ndarray, tau_t: float = 10.0, tau_s: float = 0.01, spatial_cutoff: float | None = 0.02, w_t_min: float = 0.1)[source]#
Bases:
objectDecay kernel represents a previously visited location.
Returns the product of an time- and space- dependent exponentials.
- __init__(location: np.ndarray, tau_t: float = 10.0, tau_s: float = 0.01, spatial_cutoff: float | None = 0.02, w_t_min: float = 0.1)[source]#
- step() bool[source]#
Increment the step counter, and check if the kernel is expired.
- Return type:
- Returns:
True if the kernel is expired, False otherwise.
- w_s(points: numpy.ndarray) numpy.ndarray[source]#
Compute the distance-dependent weight.
The weight is computed as exp(-z / lam), where z is the distance between the kernel’s center and the given point(s), and lam is equal to tau_s / log(2).
- class DecayKernelFactory(tau_t: float = 10.0, tau_s: float = 0.01, spatial_cutoff: float | None = 0.02, w_t_min: float = 0.1)[source]#
Bases:
object
- class ReturnInhibitor(decay_field_class: type[DecayField] = <class 'tbp.monty.frameworks.models.salience.return_inhibitor.DecayField'>, decay_field_args: dict[str, Any] | None = None)[source]#
Bases:
object
tbp.monty.frameworks.models.salience.sensor_module#
- class HabitatSalienceSM(rng, sensor_module_id: str, save_raw_obs: bool = False, salience_strategy_class: type[SalienceStrategy] = <class 'tbp.monty.frameworks.models.salience.strategies.UniformSalienceStrategy'>, salience_strategy_args: dict[str, Any] | None = None, return_inhibitor_class: type[ReturnInhibitor] = <class 'tbp.monty.frameworks.models.salience.return_inhibitor.ReturnInhibitor'>, return_inhibitor_args: dict[str, Any] | None = None, snapshot_telemetry_class: type[SnapshotTelemetry] = <class 'tbp.monty.frameworks.models.sensor_modules.SnapshotTelemetry'>) None[source]#
Bases:
SensorModule- __init__(rng, sensor_module_id, save_raw_obs=False, salience_strategy_class=<class 'tbp.monty.frameworks.models.salience.strategies.UniformSalienceStrategy'>, salience_strategy_args=None, return_inhibitor_class=<class 'tbp.monty.frameworks.models.salience.return_inhibitor.ReturnInhibitor'>, return_inhibitor_args=None, snapshot_telemetry_class=<class 'tbp.monty.frameworks.models.sensor_modules.SnapshotTelemetry'>)[source]#
- propose_goal_states() list[GoalState][source]#
Return the goal-states proposed by this Sensor Module.
- state_dict()[source]#
Return a serializable dict with this sensor module’s state.
Includes everything needed to save/load this sensor module.
tbp.monty.frameworks.models.salience.strategies#
- class UniformSalienceStrategy(*args, **kwargs)[source]#
Bases:
SalienceStrategy