agoryuno / deepsolo-onnx Goto Github PK
View Code? Open in Web Editor NEWAn ONNX exporter fot the DeepSolo scene text recognition model
An ONNX exporter fot the DeepSolo scene text recognition model
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
Thanks for your great work!!
But i have got some error,when i try to convert the .pth model to onnx!
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
。。。
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)
in the detectron2 tutorials, it said that export model into torchscript by traceing can infer on dynamic resolution images:
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.