bes-dev / crnn-pytorch

Pytorch implementation of OCR system using CRNN + CTCLoss
BSD 2-Clause "Simplified" License
217 stars 55 forks source link

Ask about seq projection #18

Open realjoenguyen opened 5 years ago

realjoenguyen commented 5 years ago

Hi everyone, Can I ask the meaning of seq_proj? I see it is used to transform the feature map from CNN? Specifically, can someone explain this segment of code? Thank you:

def features_to_sequence(self, features):
    b, c, h, w = features.size()
    assert h == 1, "the height of out must be 1"
    if not self.fully_conv:
        features = features.permute(0, 3, 2, 1)
        features = self.proj(features)
        features = features.permute(1, 0, 2, 3)
    else:
        features = features.permute(3, 0, 2, 1)
    features = features.squeeze(2)
    return features