Upload folder using huggingface_hub
Browse files- EasyOCR_model/apex_stats_detector.pth +3 -0
- EasyOCR_model/craft_mlt_25k.pth +3 -0
- EasyOCR_model/log_train.txt +0 -0
- EasyOCR_user_network/__pycache__/apex_stats_detector.cpython-310.pyc +0 -0
- EasyOCR_user_network/__pycache__/apex_stats_detector.cpython-39.pyc +0 -0
- EasyOCR_user_network/apex_stats_detector.py +101 -0
- EasyOCR_user_network/apex_stats_detector.yaml +7 -0
- lgbm_model.pkl +3 -0
EasyOCR_model/apex_stats_detector.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7e2efc7f6b123863756ab0b62f90550772f9facaae9caa78727dd9105376fc68
|
| 3 |
+
size 15257702
|
EasyOCR_model/craft_mlt_25k.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a5efbfb48b4081100544e75e1e2b57f8de3d84f213004b14b85fd4b3748db17
|
| 3 |
+
size 83152330
|
EasyOCR_model/log_train.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
EasyOCR_user_network/__pycache__/apex_stats_detector.cpython-310.pyc
ADDED
|
Binary file (3 kB). View file
|
|
|
EasyOCR_user_network/__pycache__/apex_stats_detector.cpython-39.pyc
ADDED
|
Binary file (2.98 kB). View file
|
|
|
EasyOCR_user_network/apex_stats_detector.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch.nn as nn
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class BidirectionalLSTM(nn.Module):
|
| 5 |
+
|
| 6 |
+
def __init__(self, input_size, hidden_size, output_size):
|
| 7 |
+
super(BidirectionalLSTM, self).__init__()
|
| 8 |
+
self.rnn = nn.LSTM(
|
| 9 |
+
input_size, hidden_size, bidirectional=True, batch_first=True
|
| 10 |
+
)
|
| 11 |
+
self.linear = nn.Linear(hidden_size * 2, output_size)
|
| 12 |
+
|
| 13 |
+
def forward(self, input):
|
| 14 |
+
"""
|
| 15 |
+
input : visual feature [batch_size x T x input_size]
|
| 16 |
+
output : contextual feature [batch_size x T x output_size]
|
| 17 |
+
"""
|
| 18 |
+
try: # multi gpu needs this
|
| 19 |
+
self.rnn.flatten_parameters()
|
| 20 |
+
except: # quantization doesn't work with this
|
| 21 |
+
pass
|
| 22 |
+
recurrent, _ = self.rnn(
|
| 23 |
+
input
|
| 24 |
+
) # batch_size x T x input_size -> batch_size x T x (2*hidden_size)
|
| 25 |
+
output = self.linear(recurrent) # batch_size x T x output_size
|
| 26 |
+
return output
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class VGG_FeatureExtractor(nn.Module):
|
| 30 |
+
|
| 31 |
+
def __init__(self, input_channel, output_channel=256):
|
| 32 |
+
super(VGG_FeatureExtractor, self).__init__()
|
| 33 |
+
self.output_channel = [
|
| 34 |
+
int(output_channel / 8),
|
| 35 |
+
int(output_channel / 4),
|
| 36 |
+
int(output_channel / 2),
|
| 37 |
+
output_channel,
|
| 38 |
+
]
|
| 39 |
+
self.ConvNet = nn.Sequential(
|
| 40 |
+
nn.Conv2d(input_channel, self.output_channel[0], 3, 1, 1),
|
| 41 |
+
nn.ReLU(True),
|
| 42 |
+
nn.MaxPool2d(2, 2),
|
| 43 |
+
nn.Conv2d(self.output_channel[0], self.output_channel[1], 3, 1, 1),
|
| 44 |
+
nn.ReLU(True),
|
| 45 |
+
nn.MaxPool2d(2, 2),
|
| 46 |
+
nn.Conv2d(self.output_channel[1], self.output_channel[2], 3, 1, 1),
|
| 47 |
+
nn.ReLU(True),
|
| 48 |
+
nn.Conv2d(self.output_channel[2], self.output_channel[2], 3, 1, 1),
|
| 49 |
+
nn.ReLU(True),
|
| 50 |
+
nn.MaxPool2d((2, 1), (2, 1)),
|
| 51 |
+
nn.Conv2d(
|
| 52 |
+
self.output_channel[2], self.output_channel[3], 3, 1, 1, bias=False
|
| 53 |
+
),
|
| 54 |
+
nn.BatchNorm2d(self.output_channel[3]),
|
| 55 |
+
nn.ReLU(True),
|
| 56 |
+
nn.Conv2d(
|
| 57 |
+
self.output_channel[3], self.output_channel[3], 3, 1, 1, bias=False
|
| 58 |
+
),
|
| 59 |
+
nn.BatchNorm2d(self.output_channel[3]),
|
| 60 |
+
nn.ReLU(True),
|
| 61 |
+
nn.MaxPool2d((2, 1), (2, 1)),
|
| 62 |
+
nn.Conv2d(self.output_channel[3], self.output_channel[3], 2, 1, 0),
|
| 63 |
+
nn.ReLU(True),
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
def forward(self, input):
|
| 67 |
+
return self.ConvNet(input)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class Model(nn.Module):
|
| 71 |
+
|
| 72 |
+
def __init__(self, input_channel, output_channel, hidden_size, num_class):
|
| 73 |
+
super(Model, self).__init__()
|
| 74 |
+
""" FeatureExtraction """
|
| 75 |
+
self.FeatureExtraction = VGG_FeatureExtractor(input_channel, output_channel)
|
| 76 |
+
self.FeatureExtraction_output = output_channel
|
| 77 |
+
self.AdaptiveAvgPool = nn.AdaptiveAvgPool2d((None, 1))
|
| 78 |
+
|
| 79 |
+
""" Sequence modeling"""
|
| 80 |
+
self.SequenceModeling = nn.Sequential(
|
| 81 |
+
BidirectionalLSTM(self.FeatureExtraction_output, hidden_size, hidden_size),
|
| 82 |
+
BidirectionalLSTM(hidden_size, hidden_size, hidden_size),
|
| 83 |
+
)
|
| 84 |
+
self.SequenceModeling_output = hidden_size
|
| 85 |
+
|
| 86 |
+
""" Prediction """
|
| 87 |
+
self.Prediction = nn.Linear(self.SequenceModeling_output, num_class)
|
| 88 |
+
|
| 89 |
+
def forward(self, input, text):
|
| 90 |
+
"""Feature extraction stage"""
|
| 91 |
+
visual_feature = self.FeatureExtraction(input)
|
| 92 |
+
visual_feature = self.AdaptiveAvgPool(visual_feature.permute(0, 3, 1, 2))
|
| 93 |
+
visual_feature = visual_feature.squeeze(3)
|
| 94 |
+
|
| 95 |
+
""" Sequence modeling stage """
|
| 96 |
+
contextual_feature = self.SequenceModeling(visual_feature)
|
| 97 |
+
|
| 98 |
+
""" Prediction stage """
|
| 99 |
+
prediction = self.Prediction(contextual_feature.contiguous())
|
| 100 |
+
|
| 101 |
+
return prediction
|
EasyOCR_user_network/apex_stats_detector.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
network_params:
|
| 2 |
+
input_channel: 1
|
| 3 |
+
output_channel: 256
|
| 4 |
+
hidden_size: 256
|
| 5 |
+
imgH: 64
|
| 6 |
+
lang_list: ['en', 'ru']
|
| 7 |
+
character_list: 0123456789!"#$%&'()*+,-./:;<=>?@[\]№_`{|}~ €₽ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюяЂђЃѓЄєІіЇїЈјЉљЊњЋћЌќЎўЏџҐґҒғҚқҮүҲҳҶҷӀӏӢӣӨөӮӯ
|
lgbm_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b78387f45c5b007b5e64a08606ba7a99c5669f381961eccede412295ff57da74
|
| 3 |
+
size 13555124
|