INNER CODE UNIT · Python
build_image_projection_head
apple/ml-cvnets · cvnets/image_projection_layers/__init__.py:33
def build_image_projection_head(
opts: argparse.Namespace, in_dim: int, out_dim: int, *args, **kwargs
) -> BaseImageProjectionHead:
"""Helper function to build an image projection head from command-line arguments.
Args:
opts: Command-line arguments
in_dim: Input dimension to the projection head.
out_dim: Output dimension of the projection head.
Returns:
Image projection head module.
"""
# Get the name of image projection head
image_projection_head_name = getattr(opts, "model.image_projection_head.name")
# We registered the base class using a special `name` (i.e., `__base__`)