Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
CCCD_OCR
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cao Duc Anh
CCCD_OCR
Commits
e59f2a3f
Commit
e59f2a3f
authored
Mar 28, 2024
by
Cao Duc Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 2803
parent
f36c36bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
11 deletions
+30
-11
inferonnx_croptext.ipynb
inferonnx_croptext.ipynb
+30
-11
No files found.
inferonnx_croptext.ipynb
View file @
e59f2a3f
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
}
}
],
],
"source": [
"source": [
"# Khong chay code nay neu da co fila model .onnx\n",
"# export ONNX for ONNX inference\n",
"# export ONNX for ONNX inference\n",
"%cd /home/anhcd/Projects/dac_vietocr/yolov7/\n",
"%cd /home/anhcd/Projects/dac_vietocr/yolov7/\n",
"!python export.py --weights /home/anhcd/Projects/dac_vietocr/model/yolov7croptext_reparam.pt \\\n",
"!python export.py --weights /home/anhcd/Projects/dac_vietocr/model/yolov7croptext_reparam.pt \\\n",
...
@@ -76,6 +77,24 @@
...
@@ -76,6 +77,24 @@
"# opt.dynamic = False if opt.dynamic_batch else opt.dynamic"
"# opt.dynamic = False if opt.dynamic_batch else opt.dynamic"
]
]
},
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install --upgrade setuptools pip --user\n",
"!pip install onnx \n",
"!pip install onnxruntime\n",
"#!pip install --ignore-installed PyYAML\n",
"#!pip install Pillow\n",
"\n",
"!pip install protobuf<4.21.3\n",
"!pip install onnxruntime-gpu\n",
"!pip install onnx>=1.9.0\n",
"!pip install onnx-simplifier>=0.3.6 --user"
]
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 11,
"execution_count": 11,
...
@@ -173,25 +192,25 @@
...
@@ -173,25 +192,25 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
20
,
"execution_count":
1
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"
data": {
"
ename": "NameError",
"text/plain": [
"evalue": "name 'session' is not defined",
"array([ 0. , 199.24756 , 329.392 , 367.1432 , 359.32315 ,\n
",
"output_type": "error
",
" 2. , 0.3788516], dtype=float32)"
"traceback": [
]
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
}
,
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)"
,
"execution_count": 20
,
"Cell \u001b[0;32mIn[1], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# ONNX inference\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[43msession\u001b[49m\u001b[38;5;241m.\u001b[39mrun(outname, inp)[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 3\u001b[0m outputs\n"
,
"metadata": {},
"\u001b[0;31mNameError\u001b[0m: name 'session' is not defined"
"output_type": "execute_result"
]
}
}
],
],
"source": [
"source": [
"# ONNX inference\n",
"# ONNX inference\n",
"outputs = session.run(outname, inp)[0]\n",
"outputs = session.run(outname, inp)[0]\n",
"outputs
[0]
"
"outputs"
]
]
},
},
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment