Commit e59f2a3f authored by Cao Duc Anh's avatar Cao Duc Anh

update 2803

parent f36c36bb
...@@ -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"
] ]
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment