Stanislav Kalinin commited on
Commit
9c0ac7a
1 Parent(s): 06f0671

feat: Add model configs and demo ipynb of tetradi dataset model

Browse files
tetradi/0_0.jpg ADDED
tetradi/inference_pipeline.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
tetradi/ocr_config.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alphabet": " !\"'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPRSTVWY[\\]_abcdefghiklmnoprstuvwxyz|}ЁАБВГДЕЖЗИКЛМНОПРСТУФХЦЧШЩЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё’№",
3
+ "save_dir": "/home/jovyan/skalinin/OCR-model/data/experiments/1024_128_add_new_dataset_album_augs_2",
4
+ "num_epochs": 100,
5
+ "pretrain_path": "",
6
+ "image": {
7
+ "width": 1024,
8
+ "height": 128
9
+ },
10
+ "train": {
11
+ "datasets": [
12
+ {
13
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_11032022_en/train.csv",
14
+ "prob": 0.05
15
+ },
16
+ {
17
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_11032022_ru/train.csv",
18
+ "prob": 0.1
19
+ },
20
+ {
21
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_15102021/train.csv",
22
+ "prob": 0.45
23
+ },
24
+ {
25
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_26012022/train.csv",
26
+ "prob": 0.4
27
+ }
28
+ ],
29
+ "epoch_size": 100000,
30
+ "batch_size": 64
31
+ },
32
+ "val": {
33
+ "datasets": [
34
+ {
35
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_11032022_en/val.csv",
36
+ "prob": 1
37
+ },
38
+ {
39
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_11032022_ru/val.csv",
40
+ "prob": 1
41
+ },
42
+ {
43
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_15102021/val.csv",
44
+ "prob": 1
45
+ },
46
+ {
47
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_26012022/val.csv",
48
+ "prob": 1
49
+ }
50
+ ],
51
+ "epoch_size": null,
52
+ "batch_size": 64
53
+ },
54
+ "test": {
55
+ "datasets": [
56
+ {
57
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_11032022_en/test.csv",
58
+ "prob": 1
59
+ },
60
+ {
61
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_11032022_ru/test.csv",
62
+ "prob": 1
63
+ },
64
+ {
65
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_15102021/test.csv",
66
+ "prob": 1
67
+ },
68
+ {
69
+ "csv_path": "/home/jovyan/skalinin/OCR-model/data/segmentation_26012022/test.csv",
70
+ "prob": 1
71
+ }
72
+ ],
73
+ "epoch_size": null,
74
+ "batch_size": 64
75
+ }
76
+ }
tetradi/pipeline_config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ { "main_process": {
2
+ "ImageToBGR": {
3
+ "input_format": "BGR"
4
+ },
5
+ "SegmPrediction": {
6
+ "model_path": "model-319-0.1578.ckpt",
7
+ "config_path": "segm_config-fitting_text_line_11032022.json",
8
+ "device": "cuda"
9
+ },
10
+ "RestoreImageAngle": {
11
+ "restoring_class_names": ["text_line"]
12
+ },
13
+ "ClassContourPosptrocess": {},
14
+ "OCRPrediction": {
15
+ "model_path": "model-97-0.8179.ckpt",
16
+ "config_path": "ocr_config.json",
17
+ "lm_path": "corpus_o6.arpa",
18
+ "classes_to_ocr": ["shrinked_pupil_text", "shrinked_comments"],
19
+ "device": "cuda"
20
+ },
21
+ "LineFinder": {
22
+ "line_classes": ["text_line"],
23
+ "text_classes": ["shrinked_pupil_text", "shrinked_comments"]
24
+ },
25
+ "PrepareJSON": {}
26
+ },
27
+ "classes": {
28
+ "shrinked_pupil_text": {
29
+ "contour_posptrocess": {
30
+ "BboxFromContour": {},
31
+ "UpscaleBbox": {"upscale_bbox": [1.4, 2.3]},
32
+ "CropByBbox": {}
33
+ }
34
+ },
35
+ "shrinked_comments": {
36
+ "contour_posptrocess": {
37
+ "BboxFromContour": {},
38
+ "UpscaleBbox": {"upscale_bbox": [1.4, 2.3]},
39
+ "CropByBbox": {}
40
+ }
41
+ },
42
+ "text_line": {
43
+ "contour_posptrocess": {}
44
+ }
45
+ }
46
+ }
tetradi/segm_config-fitting_text_line_11032022.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "save_dir": "/home/jovyan/SEGM-model/data/exp/fitting_text_line_11032022",
3
+ "num_epochs": 1000,
4
+ "pretrain_path": "/home/jovyan/OCR-pipeline/data/weights/resnet50_15102021_26012022_768_1024_2/model-1249-0.1312.ckpt",
5
+ "image": {
6
+ "width": 1024,
7
+ "height": 768
8
+ },
9
+ "classes": {
10
+ "shrinked_pupil_text": {
11
+ "annotation_classes": ["pupil_text"],
12
+ "polygon2mask": {
13
+ "ShrinkMaskMaker": {"shrink_ratio": 0.5}
14
+ },
15
+ "postprocess": {
16
+ "threshold": 0.8,
17
+ "min_area": 10
18
+ }
19
+ },
20
+ "shrinked_comments": {
21
+ "annotation_classes": ["pupil_comment", "teacher_comment"],
22
+ "polygon2mask": {
23
+ "ShrinkMaskMaker": {"shrink_ratio": 0.5}
24
+ },
25
+ "postprocess": {
26
+ "threshold": 0.8,
27
+ "min_area": 10
28
+ }
29
+ },
30
+ "text_line": {
31
+ "annotation_classes": ["text_line"],
32
+ "polygon2mask": {
33
+ "PolylineToMask": {"thickness": 2, "scale": 0.95}
34
+ },
35
+ "postprocess": {
36
+ "threshold": 0.8,
37
+ "min_area": 10
38
+ }
39
+ }
40
+ },
41
+ "train": {
42
+ "datasets": [
43
+ {
44
+ "json_path": "/home/jovyan/data/htr_dataset_SEGM_11032022/en_ru_tetradi/ru/annotations_train.json",
45
+ "image_root": "/home/jovyan/data/htr_dataset_SEGM_11032022/en_ru_tetradi/ru/images_rotated/",
46
+ "processed_data_path": "/home/jovyan/SEGM-model/data/htr_dataset_SEGM_11032022_ru/annotations_train.csv"
47
+ }
48
+ ],
49
+ "batch_size": 10
50
+ },
51
+ "val": {
52
+ "datasets": [
53
+ {
54
+ "json_path": "/home/jovyan/data/htr_dataset_SEGM_11032022/en_ru_tetradi/ru/annotations_val.json",
55
+ "image_root": "/home/jovyan/data/htr_dataset_SEGM_11032022/en_ru_tetradi/ru/images_rotated/",
56
+ "processed_data_path": "/home/jovyan/SEGM-model/data/htr_dataset_SEGM_11032022_ru/annotations_val.csv"
57
+ }
58
+ ],
59
+ "batch_size": 10
60
+ },
61
+ "test": {
62
+ "datasets": [
63
+ {
64
+ "json_path": "/home/jovyan/data/htr_dataset_SEGM_11032022/en_ru_tetradi/ru/annotations_test.json",
65
+ "image_root": "/home/jovyan/data/htr_dataset_SEGM_11032022/en_ru_tetradi/ru/images_rotated/",
66
+ "processed_data_path": "/home/jovyan/SEGM-model/data/htr_dataset_SEGM_11032022_ru/annotations_val.csv"
67
+ }
68
+ ],
69
+ "batch_size": 10
70
+ }
71
+ }
72
+