Skip to content

Commit

Permalink
fix(single-mode): error when recognize race
Browse files Browse the repository at this point in the history
  • Loading branch information
NateScarlet committed Jun 15, 2021
1 parent 8dbcb33 commit 56032df
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion auto_derby/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def _get_expanded_bbox(index: int) -> Tuple[int, int, int, int]:
char_parts
and l > char_non_zero_bbox[2]
and (
l - char_non_zero_bbox[0] > max_char_width * 0.6
l - char_non_zero_bbox[0] > max_char_width * 0.7
or l - char_non_zero_bbox[2] > max_char_width * 0.2
or r - char_non_zero_bbox[0] > max_char_width
or (
Expand Down
10 changes: 10 additions & 0 deletions auto_derby/single_mode/race_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ def test_find_by_race_detail_image_9():
assert race1.stadium == "京都", race1.stadium


def test_find_by_race_detail_image_10():
img = PIL.Image.open(_test.DATA_PATH / "race_detail_10.png").convert("RGB")
ctx = Context()
ctx.date = (1, 9, 1)
race1 = race.find_by_race_detail_image(ctx, img)

assert race1.name == "小倉ジュニアステークス", race1.name
assert race1.stadium == "小倉", race1.stadium


def test_find_by_race_detail_image_issue31():
img = (
PIL.Image.open(_test.DATA_PATH / "race_detail_issue31.png")
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion ocr_labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -643,5 +643,7 @@
"00007e0078cc30fc18feffcff7fff8ff18fe18fc7efc8ffc8fcdfffdff7c0008": "",
"fe3ffe7fe001e001e001feff86e706c386c3f6ff9eff86e186e1fefffefffc7f": "",
"00003818fe0fffc7fec77efe66fe76fe7e7e7e067e063e3e22fe7efefeff427e": "",
"f80ffc1f3e7c1e780f700f701ff83efcfcffe0fb0070007808783e7efc3ff80f": "9"
"f80ffc1f3e7c1e780f700f701ff83efcfcffe0fb0070007808783e7efc3ff80f": "9",
"800380038003983b9c3b9c7b9c7b9e739e738ff387e387438003e003f003f001": "",
"8001e007f83ffefffefffc7ffc3f1c301c301c38fc3ffe3ffefffefff8ffe07f": ""
}
4 changes: 3 additions & 1 deletion single_mode_choices.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,7 @@
"03570efc489d51383e403812360ffb8b": 2,
"c3dec6e3c4b4f3158b1c555bee9755e6": 1,
"da09be83fc01e842ac2dcd6790849c0d": 2,
"b846741f4d033493165584ef05567b5a": 1
"b846741f4d033493165584ef05567b5a": 1,
"ca0db1e260ab5c8abf6dc712f3d88db3": 2,
"8fde2da6a43d9b2d5156892baa50e498": 2
}

0 comments on commit 56032df

Please sign in to comment.