ragavsachdeva
commited on
Commit
•
79ac1fb
1
Parent(s):
4dab343
Update modelling_magi.py
Browse files- modelling_magi.py +2 -1
modelling_magi.py
CHANGED
@@ -67,7 +67,7 @@ class MagiModel(PreTrainedModel):
|
|
67 |
character_detection_threshold=0.3,
|
68 |
panel_detection_threshold=0.2,
|
69 |
text_detection_threshold=0.25,
|
70 |
-
character_character_matching_threshold=0.
|
71 |
text_character_matching_threshold=0.4,
|
72 |
):
|
73 |
assert not self.config.disable_detections
|
@@ -454,6 +454,7 @@ class MagiModel(PreTrainedModel):
|
|
454 |
char_ij_c2c = torch.cat([char_ij, c2c], dim=-1)
|
455 |
character_character_affinities = self.character_character_matching_head(char_ij_c2c)
|
456 |
character_character_affinities = rearrange(character_character_affinities, "(i j) 1 -> i j", i=char_i.shape[0])
|
|
|
457 |
if apply_sigmoid:
|
458 |
character_character_affinities = character_character_affinities.sigmoid()
|
459 |
affinity_matrices.append(character_character_affinities)
|
|
|
67 |
character_detection_threshold=0.3,
|
68 |
panel_detection_threshold=0.2,
|
69 |
text_detection_threshold=0.25,
|
70 |
+
character_character_matching_threshold=0.65,
|
71 |
text_character_matching_threshold=0.4,
|
72 |
):
|
73 |
assert not self.config.disable_detections
|
|
|
454 |
char_ij_c2c = torch.cat([char_ij, c2c], dim=-1)
|
455 |
character_character_affinities = self.character_character_matching_head(char_ij_c2c)
|
456 |
character_character_affinities = rearrange(character_character_affinities, "(i j) 1 -> i j", i=char_i.shape[0])
|
457 |
+
character_character_affinities = (character_character_affinities + character_character_affinities.T) / 2
|
458 |
if apply_sigmoid:
|
459 |
character_character_affinities = character_character_affinities.sigmoid()
|
460 |
affinity_matrices.append(character_character_affinities)
|