RubanSeven / CRAFT_keras

Keras implementation of Character Region Awareness for Text Detection (CRAFT)
Apache License 2.0
166 stars 57 forks source link

I think conv_cls output (number of filters) seems not correct #13

Open opconty opened 4 years ago

opconty commented 4 years ago

first of all, this is a wonderful repo. thanks for author's contribution. and I have one question:

python self.conv_cls = nn.Sequential( nn.Conv2d(32, 32, kernel_size=3, padding=1), nn.ReLU(inplace=True), nn.Conv2d(32, 32, kernel_size=3, padding=1), nn.ReLU(inplace=True), nn.Conv2d(32, 16, kernel_size=3, padding=1), nn.ReLU(inplace=True), nn.Conv2d(16, 16, kernel_size=1), nn.ReLU(inplace=True), nn.Conv2d(16, num_class, kernel_size=1), )

this is orginal craft output layer, input #filters is 16, output #filters is num_class.

while this repo is x = conv_cls(feature, 2), x = Conv2D(16, kernel_size=num_filter, padding='same', activation='sigmoid')(x) I think it should be x = Conv2D(num_filter, kernel_size=1, padding='same', activation='sigmoid')(x)

plz correct me if i'm wrong.

PacinoAn commented 4 years ago

me too,the output channel should be 2 but not 16 See the original pytorch impl:

    self.conv_cls = nn.Sequential(
        nn.Conv2d(32, 32, kernel_size=3, padding=1), nn.ReLU(inplace=True),
        nn.Conv2d(32, 32, kernel_size=3, padding=1), nn.ReLU(inplace=True),
        nn.Conv2d(32, 16, kernel_size=3, padding=1), nn.ReLU(inplace=True),
        nn.Conv2d(16, 16, kernel_size=1), nn.ReLU(inplace=True),
        nn.Conv2d(16, num_class, kernel_size=1),
    )
nightfuryyy commented 4 years ago

me too,the output channel should be 2 but not 16 See the original pytorch impl:

    self.conv_cls = nn.Sequential(
        nn.Conv2d(32, 32, kernel_size=3, padding=1), nn.ReLU(inplace=True),
        nn.Conv2d(32, 32, kernel_size=3, padding=1), nn.ReLU(inplace=True),
        nn.Conv2d(32, 16, kernel_size=3, padding=1), nn.ReLU(inplace=True),
        nn.Conv2d(16, 16, kernel_size=1), nn.ReLU(inplace=True),
        nn.Conv2d(16, num_class, kernel_size=1),
    )
x = Conv2D(32, kernel_size=3, padding='same', activation='relu')(input_tensor)
x = Conv2D(32, kernel_size=3, padding='same', activation='relu')(x)
x = Conv2D(16, kernel_size=3, padding='same', activation='relu')(x)
x = Conv2D(16, kernel_size=1, padding='valid', activation='relu')(x)
x = Conv2D(num_class, kernel_size=1, padding='valid')(x)

is that correct ?