Posgen
Shared position-generation utilities.
common ¶
Common building blocks for future position-generation packages.
PositionContent
dataclass
¶
Minimal tensor content schema shared by position generators.
Source code in lib/posgen/src/posgen/common/content.py
11 12 13 14 15 16 | |
DatasetName ¶
Bases: StrEnum
Canonical poster/content dataset names supported by posgen.
Source code in lib/posgen/src/posgen/common/labels.py
9 10 11 12 13 14 15 16 17 18 | |
id2label_for_dataset ¶
id2label_for_dataset(
dataset_name: DatasetName | str,
) -> dict[int, str]
Return an integer-id to label-name mapping for a posgen dataset.
Source code in lib/posgen/src/posgen/common/labels.py
129 130 131 | |
label2id_for_dataset ¶
label2id_for_dataset(
dataset_name: DatasetName | str,
) -> dict[str, int]
Return a label-name to integer-id mapping for a posgen dataset.
Source code in lib/posgen/src/posgen/common/labels.py
134 135 136 | |
labels_for_dataset ¶
labels_for_dataset(
dataset_name: DatasetName | str,
) -> tuple[str, ...]
Return the ordered label vocabulary for a posgen dataset.
Source code in lib/posgen/src/posgen/common/labels.py
124 125 126 | |
normalize_dataset_name ¶
normalize_dataset_name(
dataset_name: DatasetName | str,
) -> DatasetName
Normalize poster/content dataset aliases to canonical names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_name
|
DatasetName | str
|
Dataset enum or public/release alias. |
required |
Returns:
| Type | Description |
|---|---|
DatasetName
|
Canonical posgen dataset enum. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the dataset name is unknown. |
Source code in lib/posgen/src/posgen/common/labels.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
normalize_label ¶
normalize_label(label: str) -> str
Normalize a position-generation label key.
Source code in lib/posgen/src/posgen/common/labels.py
98 99 100 | |
assert_position_content_schema ¶
assert_position_content_schema(
content: PositionContent,
) -> None
Check the minimal position-generation content schema.
Source code in lib/posgen/src/posgen/common/testing.py
8 9 10 11 12 13 | |
render_position_summary ¶
render_position_summary(content: PositionContent) -> str
Return a compact text summary for a position-generation sample.
Source code in lib/posgen/src/posgen/common/visualization.py
6 7 8 | |
content ¶
Content containers reserved for future position-generation models.
PositionContent
dataclass
¶
Minimal tensor content schema shared by position generators.
Source code in lib/posgen/src/posgen/common/content.py
11 12 13 14 15 16 | |
labels ¶
Dataset label registries shared by position-generation packages.
DatasetName ¶
Bases: StrEnum
Canonical poster/content dataset names supported by posgen.
Source code in lib/posgen/src/posgen/common/labels.py
9 10 11 12 13 14 15 16 17 18 | |
CGLLabel ¶
Bases: StrEnum
CGL label names in dataset id order.
Source code in lib/posgen/src/posgen/common/labels.py
21 22 23 24 25 26 27 28 | |
PKUPosterLayoutLabel ¶
Bases: StrEnum
PKU-PosterLayout label names in dataset id order.
Source code in lib/posgen/src/posgen/common/labels.py
31 32 33 34 35 36 37 | |
CrelloLabel ¶
Bases: StrEnum
Crello label names in dataset id order.
Source code in lib/posgen/src/posgen/common/labels.py
40 41 42 43 44 45 46 47 | |
AdBannerLabel ¶
Bases: StrEnum
Ad Banner label names in LayoutDETR dataset id order.
Source code in lib/posgen/src/posgen/common/labels.py
50 51 52 53 54 55 56 57 58 59 60 | |
normalize_label ¶
normalize_label(label: str) -> str
Normalize a position-generation label key.
Source code in lib/posgen/src/posgen/common/labels.py
98 99 100 | |
normalize_dataset_name ¶
normalize_dataset_name(
dataset_name: DatasetName | str,
) -> DatasetName
Normalize poster/content dataset aliases to canonical names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_name
|
DatasetName | str
|
Dataset enum or public/release alias. |
required |
Returns:
| Type | Description |
|---|---|
DatasetName
|
Canonical posgen dataset enum. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the dataset name is unknown. |
Source code in lib/posgen/src/posgen/common/labels.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
labels_for_dataset ¶
labels_for_dataset(
dataset_name: DatasetName | str,
) -> tuple[str, ...]
Return the ordered label vocabulary for a posgen dataset.
Source code in lib/posgen/src/posgen/common/labels.py
124 125 126 | |
id2label_for_dataset ¶
id2label_for_dataset(
dataset_name: DatasetName | str,
) -> dict[int, str]
Return an integer-id to label-name mapping for a posgen dataset.
Source code in lib/posgen/src/posgen/common/labels.py
129 130 131 | |
label2id_for_dataset ¶
label2id_for_dataset(
dataset_name: DatasetName | str,
) -> dict[str, int]
Return a label-name to integer-id mapping for a posgen dataset.
Source code in lib/posgen/src/posgen/common/labels.py
134 135 136 | |
testing ¶
Testing helpers reserved for future position-generation packages.
assert_position_content_schema ¶
assert_position_content_schema(
content: PositionContent,
) -> None
Check the minimal position-generation content schema.
Source code in lib/posgen/src/posgen/common/testing.py
8 9 10 11 12 13 | |
visualization ¶
Visualization placeholders for future position-generation outputs.
render_position_summary ¶
render_position_summary(content: PositionContent) -> str
Return a compact text summary for a position-generation sample.
Source code in lib/posgen/src/posgen/common/visualization.py
6 7 8 | |