Datasets:
Download scripts/test_export_yolo.py from dinhanhx/ftu-VietFinTab: direct link, hf CLI and curl.
- Browser
- Download file 551 Bytes
-
https://huggingface.co/datasets/dinhanhx/ftu-VietFinTab/resolve/main/scripts/test_export_yolo.py
- Command line
-
hf download hf://datasets/dinhanhx/ftu-VietFinTab/scripts/test_export_yolo.py
-
curl -L -o test_export_yolo.py https://huggingface.co/datasets/dinhanhx/ftu-VietFinTab/resolve/main/scripts/test_export_yolo.py
551 Bytes
| # /// script | |
| # requires-python = ">=3.10" | |
| # dependencies = [] | |
| # /// | |
| from export_yolo import cells, yolo_lines | |
| rows = [(0, 0, 100, 10), (0, 10, 100, 20)] | |
| cols = [(0, 0, 50, 20), (50, 0, 100, 20)] | |
| span = [(0, 0, 100, 10)] # merges the whole first row | |
| c = cells(rows, cols, span) | |
| assert sorted(c) == [(0, 0, 100, 10), (0, 10, 50, 20), (50, 10, 100, 20)], c | |
| assert yolo_lines(100, 20, [[(0, 0, 100, 10)], [], []]) == ["0 0.500000 0.250000 1.000000 0.500000"] | |
| assert yolo_lines(100, 20, [[(0, 0, 0, 10)], [], []]) == [] # degenerate dropped | |
| print("ok") | |