GithubHelp home page GithubHelp logo

agoryuno / deepsolo-onnx Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 232 KB

An ONNX exporter fot the DeepSolo scene text recognition model

Python 81.42% C++ 1.52% Cuda 13.98% Jupyter Notebook 3.08%
ai inference onnx python scene-text-detection scene-text-recognition deepsolo

deepsolo-onnx's People

Contributors

agoryuno avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

deepsolo-onnx's Issues

exported onnx models as download

Hi,
thank you for your implementation.
Unfortunately, I run into some issues with the Google Colab notebook.
I just want to run some tests and want to ask you if you kindly could provide one .onnx file (maybe the one trained on TotalText and mentioned as Res-50, MLT17+IC13+IC15+TextOCR or anyone else) on some cloud storage?
There was some issue with the CUDA version available on Google Colab and the one with which torch/torchvision are built.
Would be great!

Thank you and all the bests,
Stephan

unsupported type: Instances

Thanks for your great work!!
But i have got some error,when i try to convert the .pth model to onnx!
image

xxxxx/DeepSolo/adet/modeling/text_spotter.py:260: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
width = input_per_image.get("width", image_size[1].item())

RuntimeError: Only tuples, lists and Variables are supported as JIT inputs/outputs. Dictionaries and strings are also accepted, but their usage is not recommended. Here, received an input of unsupported type: Instances

export error

image
when i run this export code in colab,this problem occured

Segmentation fault (core dumped)

When I run the code copied on deepsolo-onnx-export.ipynb to export the model with
BACKBONE: NAME: "build_resnet_backbone"
some error occur as follow:

/data_local/deepsolo/deepsolo-onnx/DeepSolo/adet/modeling/model/detection_transformer.py:221: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if reference.shape[-1] == 2:
/data_local/deepsolo/deepsolo-onnx/DeepSolo/adet/modeling/model/detection_transformer.py:271: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
  for a, b, c, d in zip(outputs_class[:-1], outputs_text[:-1], outputs_coord[:-1], outputs_bd_coord[:-1])
Segmentation fault (core dumped)

the code is as follow

import os
import shutil
from DeepSolo.onnx_model import SimpleONNXReadyModel
import numpy as np
CHECKPOINT = "/result/R50/150k_tt_mlt_13_15/finetune/ic15/model_final.pth"
OUTPATH = "/result/R50/150k_tt_mlt_13_15/finetune/ic15/deepsolo.onnx"
DIMS = (512,512)
CONFIG = "configs/Base_det_export_R5.yaml"
CHANNELS = 3
model = SimpleONNXReadyModel(CONFIG, CHECKPOINT)
img = np.random.randint(0, 255, (CHANNELS, *DIMS))
img = img.astype(np.int8)
import torch.onnx
import torch
img_t = torch.from_numpy(img)
torch.onnx.export(model.model,
           [img_t],
           OUTPATH,
           export_params=True,
           do_constant_folding=True, opset_version=11)

question about dynamic resolution

in the detectron2 tutorials, it said that export model into torchscript by traceing can infer on dynamic resolution images:
image

but when i export the model, the torchscript model only can inferrence on the images that have same height and width with the dummy image i used for exporting the model. i'd like to know whether your exported model can inference on dynamic resolution images.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.