File size: 3,789 Bytes
77f8d5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
"""
Paper: "UTRNet: High-Resolution Urdu Text Recognition In Printed Documents" presented at ICDAR 2023
Authors: Abdur Rahman, Arjun Ghosh, Chetan Arora
GitHub Repository: https://github.com/abdur75648/UTRNet-High-Resolution-Urdu-Text-Recognition
Project Website: https://abdur75648.github.io/UTRNet/
Copyright (c) 2023-present: This work is licensed under the Creative Commons Attribution-NonCommercial
4.0 International License (http://creativecommons.org/licenses/by-nc/4.0/)
"""

import torch.nn as nn

from .densenet import DenseNet
from .hrnet import HRNet
from .inception_unet import InceptionUNet
from .rcnn import RCNN
from .resnet import ResNet
from .resunet import ResUnet
from .unet_attn import AttnUNet
from .unet_plus_plus import NestedUNet
from .unet import UNet
from .vgg import VGG

class DenseNet_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=512):
        super(DenseNet_FeatureExtractor, self).__init__()
        self.ConvNet = DenseNet(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)

class HRNet_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=32):
        super(HRNet_FeatureExtractor, self).__init__()
        self.ConvNet = HRNet(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)

class InceptionUNet_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=512):
        super(InceptionUNet_FeatureExtractor, self).__init__()
        self.ConvNet = InceptionUNet(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)

class RCNN_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=512):
        super(RCNN_FeatureExtractor, self).__init__()
        self.ConvNet = RCNN(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)

class ResNet_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=512):
        super(ResNet_FeatureExtractor, self).__init__()
        self.ConvNet = ResNet(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)
    
class ResUnet_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=512):
        super(ResUnet_FeatureExtractor, self).__init__()
        self.ConvNet = ResUnet(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)

class AttnUNet_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=512):
        super(AttnUNet_FeatureExtractor, self).__init__()
        self.ConvNet = AttnUNet(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)

class UNet_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=512):
        super(UNet_FeatureExtractor, self).__init__()
        self.ConvNet = UNet(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)

class UNetPlusPlus_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=512):
        super(UNetPlusPlus_FeatureExtractor, self).__init__()
        self.ConvNet = NestedUNet(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)

class VGG_FeatureExtractor(nn.Module):
    def __init__(self, input_channel=1, output_channel=512):
        super(VGG_FeatureExtractor, self).__init__()
        self.ConvNet = VGG(input_channel, output_channel)

    def forward(self, input):
        return self.ConvNet(input)
    
# x = torch.randn(1, 1, 32, 400)
# model = UNet_FeatureExtractor()
# out = model(x)