Spaces:
Running
Running
Download ocr-studio/PaddleOCR/benchmark/PaddleOCR_DBNet/models/basic.py from phucsd/cham-ocr-studio: direct link, hf CLI and curl.
- Browser
- Download file 996 Bytes
-
https://huggingface.co/spaces/phucsd/cham-ocr-studio/resolve/main/ocr-studio/PaddleOCR/benchmark/PaddleOCR_DBNet/models/basic.py
- Command line
-
hf download hf://spaces/phucsd/cham-ocr-studio/ocr-studio/PaddleOCR/benchmark/PaddleOCR_DBNet/models/basic.py
-
curl -L -o basic.py https://huggingface.co/spaces/phucsd/cham-ocr-studio/resolve/main/ocr-studio/PaddleOCR/benchmark/PaddleOCR_DBNet/models/basic.py
996 Bytes
| # -*- coding: utf-8 -*- | |
| # @Time : 2019/12/6 11:19 | |
| # @Author : zhoujun | |
| from paddle import nn | |
| class ConvBnRelu(nn.Layer): | |
| def __init__(self, | |
| in_channels, | |
| out_channels, | |
| kernel_size, | |
| stride=1, | |
| padding=0, | |
| dilation=1, | |
| groups=1, | |
| bias=True, | |
| padding_mode='zeros', | |
| inplace=True): | |
| super().__init__() | |
| self.conv = nn.Conv2D( | |
| in_channels=in_channels, | |
| out_channels=out_channels, | |
| kernel_size=kernel_size, | |
| stride=stride, | |
| padding=padding, | |
| dilation=dilation, | |
| groups=groups, | |
| bias_attr=bias, | |
| padding_mode=padding_mode) | |
| self.bn = nn.BatchNorm2D(out_channels) | |
| self.relu = nn.ReLU() | |
| def forward(self, x): | |
| x = self.conv(x) | |
| x = self.bn(x) | |
| x = self.relu(x) | |
| return x | |