MixedScaleGeometryMultiViewGenerator#

class MixedScaleGeometryMultiViewGenerator(fine_local_view_num=3, fine_local_view_scale=(0.01, 0.04), fine_center_mode='geometry', fine_center_top_frac=0.05, fine_center_k=24, **kwargs)[source]#

Bases: MultiViewGenerator

Multi-view generator with coarse locals plus extra fine local crops.

Subclass of MultiViewGenerator that replaces fine_local_view_num of the local crops with much smaller (fine_local_view_scale) crops whose centers come either from uniform sampling (fine_center_mode="random") or from a local-PCA directional-complexity score ("geometry", keeping the top fine_center_top_frac of points by complexity). Keeps the SSL objective unchanged while steering which local regions feed the local-global loss; reads/writes the same keys as the base class. All base-class arguments are accepted via **kwargs. Registered as MixedScaleGeometryMultiViewGenerator — use this string as the type in a transform=[...] config list.

Parameters:
  • fine_local_view_num (int) – Number of fine local crops (must satisfy 0 <= fine_local_view_num <= local_view_num). Defaults to 3.

  • fine_local_view_scale (tuple) – (min, max) fraction of points per fine local crop. Defaults to (0.01, 0.04).

  • fine_center_mode (str) – "geometry" to bias fine centers toward high-complexity points, or "random" for uniform. Defaults to "geometry".

  • fine_center_top_frac (float) – Top fraction of points (by complexity) eligible as fine centers in "geometry" mode. Defaults to 0.05.

  • fine_center_k (int) – Neighbor count for the local-PCA complexity score. Defaults to 24.

  • **kwargs – Forwarded to MultiViewGenerator.

Example

>>> import numpy as np
>>> np.random.seed(0)
>>> data = {"coord": np.random.rand(300, 3).astype("f4"),
...         "energy": np.random.rand(300, 1).astype("f4"),
...         "index_valid_keys": ["coord", "energy"]}
>>> out = MixedScaleGeometryMultiViewGenerator(
...     fine_local_view_num=2, local_view_num=4,
...     view_keys=("coord", "energy"))(data)
>>> out["local_coord"].shape, out["local_offset"]
((193, 3), array([  8,  14, 105, 193]))
# first 2 locals are tiny geometry-biased fine crops (8, 6 pts), then coarse locals