Skip to content

Releases: wkpark/CRAFT-pytorch

CRAFT models

12 Mar 16:33

Choose a tag to compare

from original google drive site:

fp32

sha256sum 4a5efbfb48b4081100544e75e1e2b57f8de3d84f213004b14b85fd4b3748db17  craft_mlt_25k.pth
md5sum 2f8227d2def4037cdb3b34389dcf9ec1 craft_mlt_25k.pth

and a converted fp16 version.

sha256sum deb270b9123830f2185a37bd391a59a414967914f883b802d79796b9b0631e40  craft_mlt_25k_fp16.pth
md5sum d44fa29e0243dc8751a0ce4b1036764b  craft_mlt_25k_fp16.pth

(2025/06/04) onnx export script based on https://github.com/frk-tt/CRAFT-onnx/blob/main/craft2onnx.py

...
image = imgproc.loadImage("tests/mytest.jpg")
#print(image.shape)
image = image[0:640, 0:320]

# preprocessing
x = imgproc.normalizeMeanVariance(image)
x = torch.from_numpy(x).permute(2, 0, 1)    # [h, w, c] to [c, h, w]
x = Variable(x.unsqueeze(0))                # [c, h, w] to [b, c, h, w]

shape_dict = {
    'input': {
        0: 'batch_size',
        2: 'height',
        3: 'width',
    },
    # variable lenght axes
    'output_0': [1, 2], 'output_1': [2, 3]
}


torch.onnx.export(net,
                  x,
                  'craft_mlt_.onnx',
                  input_names=['input'],
                  output_names=['output_0', 'output_1'],
                  export_params=True,
                  opset_version=10, # opset_version=11 may not work with onnx2tf
                  do_constant_folding=True,
                  dynamic_axes=shape_dict,
                  #verbose=True,
                  verbose=False,
)
sha256:225285114741baecefc0380d4373eb1dfffab617069e413f9baa2e18da6430c7 craft_mlt_25k.onnx