@@ -44,9 +44,13 @@ def render_scene(record: dict[str, Any], output_path: Path, image_size: int = 22
|
||||
for index in range(10):
|
||||
current_radius = radius if index % 2 == 0 else radius * 0.45
|
||||
angle = -math.pi / 2 + index * math.pi / 5
|
||||
points.append((x + current_radius * math.cos(angle), y + current_radius * math.sin(angle)))
|
||||
points.append(
|
||||
(
|
||||
x + current_radius * math.cos(angle),
|
||||
y + current_radius * math.sin(angle),
|
||||
)
|
||||
)
|
||||
draw.polygon(points, fill=color, outline=(20, 20, 20))
|
||||
draw.text((x - radius, y + radius + int(4 * scale)), item["object_id"], fill=(20, 20, 20))
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
image.save(output_path)
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ from data.schema import FACT_TYPE, NULL_TYPE, RULE_TYPE
|
||||
from losses.matching_loss import hungarian_matching_loss
|
||||
from models.evidence_model import EvidenceExtractorModel
|
||||
|
||||
|
||||
COUNT_KEYS = ("tp", "fp", "fn", "component_correct", "component_total")
|
||||
|
||||
|
||||
|
||||
@@ -54,7 +54,9 @@ class TinyFrozenBackbone(FrozenBackbone):
|
||||
ids.append((int.from_bytes(digest, "little") % 256) + 1)
|
||||
encoded.append(ids or [1])
|
||||
length = max(len(row) for row in encoded)
|
||||
input_ids = torch.zeros(len(encoded), length, dtype=torch.long, device=self.patch.weight.device)
|
||||
input_ids = torch.zeros(
|
||||
len(encoded), length, dtype=torch.long, device=self.patch.weight.device
|
||||
)
|
||||
mask = torch.zeros_like(input_ids, dtype=torch.bool)
|
||||
for index, row in enumerate(encoded):
|
||||
input_ids[index, : len(row)] = torch.tensor(row, device=input_ids.device)
|
||||
|
||||
Reference in New Issue
Block a user