mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 21:44:22 +08:00
update cli.md for export ncnn model (#3846)
This commit is contained in:
parent
796bac229e
commit
cf3c740fe7
@ -179,6 +179,7 @@ i.e. `format='onnx'` or `format='engine'`.
|
|||||||
| [TF Edge TPU](https://coral.ai/docs/edgetpu/models-intro/) | `edgetpu` | `yolov8n_edgetpu.tflite` | ✅ |
|
| [TF Edge TPU](https://coral.ai/docs/edgetpu/models-intro/) | `edgetpu` | `yolov8n_edgetpu.tflite` | ✅ |
|
||||||
| [TF.js](https://www.tensorflow.org/js) | `tfjs` | `yolov8n_web_model/` | ✅ |
|
| [TF.js](https://www.tensorflow.org/js) | `tfjs` | `yolov8n_web_model/` | ✅ |
|
||||||
| [PaddlePaddle](https://github.com/PaddlePaddle) | `paddle` | `yolov8n_paddle_model/` | ✅ |
|
| [PaddlePaddle](https://github.com/PaddlePaddle) | `paddle` | `yolov8n_paddle_model/` | ✅ |
|
||||||
|
| [ncnn](https://github.com/Tencent/ncnn) | `ncnn` | `yolov8n_ncnn_model/` | ✅ |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@
|
|||||||
"| [TensorFlow Edge TPU](https://coral.ai/docs/edgetpu/models-intro/) | `edgetpu` | `yolov8n_edgetpu.tflite` |\n",
|
"| [TensorFlow Edge TPU](https://coral.ai/docs/edgetpu/models-intro/) | `edgetpu` | `yolov8n_edgetpu.tflite` |\n",
|
||||||
"| [TensorFlow.js](https://www.tensorflow.org/js) | `tfjs` | `yolov8n_web_model/` |\n",
|
"| [TensorFlow.js](https://www.tensorflow.org/js) | `tfjs` | `yolov8n_web_model/` |\n",
|
||||||
"| [PaddlePaddle](https://github.com/PaddlePaddle) | `paddle` | `yolov8n_paddle_model/` |\n",
|
"| [PaddlePaddle](https://github.com/PaddlePaddle) | `paddle` | `yolov8n_paddle_model/` |\n",
|
||||||
"| [NCNN](https://github.com/Tencent/ncnn) | `ncnn` | `yolov8n_ncnn_model/` |\n"
|
"| [ncnn](https://github.com/Tencent/ncnn) | `ncnn` | `yolov8n_ncnn_model/` |\n"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"id": "nPZZeNrLCQG6"
|
"id": "nPZZeNrLCQG6"
|
||||||
|
@ -16,7 +16,7 @@ TensorFlow Lite | `tflite` | yolov8n.tflite
|
|||||||
TensorFlow Edge TPU | `edgetpu` | yolov8n_edgetpu.tflite
|
TensorFlow Edge TPU | `edgetpu` | yolov8n_edgetpu.tflite
|
||||||
TensorFlow.js | `tfjs` | yolov8n_web_model/
|
TensorFlow.js | `tfjs` | yolov8n_web_model/
|
||||||
PaddlePaddle | `paddle` | yolov8n_paddle_model/
|
PaddlePaddle | `paddle` | yolov8n_paddle_model/
|
||||||
NCNN | `ncnn` | yolov8n_ncnn_model/
|
ncnn | `ncnn` | yolov8n_ncnn_model/
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
$ pip install ultralytics[export]
|
$ pip install ultralytics[export]
|
||||||
@ -89,7 +89,7 @@ def export_formats():
|
|||||||
['TensorFlow Edge TPU', 'edgetpu', '_edgetpu.tflite', True, False],
|
['TensorFlow Edge TPU', 'edgetpu', '_edgetpu.tflite', True, False],
|
||||||
['TensorFlow.js', 'tfjs', '_web_model', True, False],
|
['TensorFlow.js', 'tfjs', '_web_model', True, False],
|
||||||
['PaddlePaddle', 'paddle', '_paddle_model', True, True],
|
['PaddlePaddle', 'paddle', '_paddle_model', True, True],
|
||||||
['NCNN', 'ncnn', '_ncnn_model', True, True], ]
|
['ncnn', 'ncnn', '_ncnn_model', True, True], ]
|
||||||
return pandas.DataFrame(x, columns=['Format', 'Argument', 'Suffix', 'CPU', 'GPU'])
|
return pandas.DataFrame(x, columns=['Format', 'Argument', 'Suffix', 'CPU', 'GPU'])
|
||||||
|
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ class Exporter:
|
|||||||
f[9], _ = self.export_tfjs()
|
f[9], _ = self.export_tfjs()
|
||||||
if paddle: # PaddlePaddle
|
if paddle: # PaddlePaddle
|
||||||
f[10], _ = self.export_paddle()
|
f[10], _ = self.export_paddle()
|
||||||
if ncnn: # NCNN
|
if ncnn: # ncnn
|
||||||
f[11], _ = self.export_ncnn()
|
f[11], _ = self.export_ncnn()
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
@ -401,14 +401,14 @@ class Exporter:
|
|||||||
return f, None
|
return f, None
|
||||||
|
|
||||||
@try_export
|
@try_export
|
||||||
def export_ncnn(self, prefix=colorstr('NCNN:')):
|
def export_ncnn(self, prefix=colorstr('ncnn:')):
|
||||||
"""
|
"""
|
||||||
YOLOv8 NCNN export using PNNX https://github.com/pnnx/pnnx.
|
YOLOv8 ncnn export using PNNX https://github.com/pnnx/pnnx.
|
||||||
"""
|
"""
|
||||||
check_requirements('git+https://github.com/Tencent/ncnn.git' if ARM64 else 'ncnn') # requires NCNN
|
check_requirements('git+https://github.com/Tencent/ncnn.git' if ARM64 else 'ncnn') # requires ncnn
|
||||||
import ncnn # noqa
|
import ncnn # noqa
|
||||||
|
|
||||||
LOGGER.info(f'\n{prefix} starting export with NCNN {ncnn.__version__}...')
|
LOGGER.info(f'\n{prefix} starting export with ncnn {ncnn.__version__}...')
|
||||||
f = Path(str(self.file).replace(self.file.suffix, f'_ncnn_model{os.sep}'))
|
f = Path(str(self.file).replace(self.file.suffix, f'_ncnn_model{os.sep}'))
|
||||||
f_ts = str(self.file.with_suffix('.torchscript'))
|
f_ts = str(self.file.with_suffix('.torchscript'))
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ class AutoBackend(nn.Module):
|
|||||||
metadata = w.parents[1] / 'metadata.yaml'
|
metadata = w.parents[1] / 'metadata.yaml'
|
||||||
elif ncnn: # ncnn
|
elif ncnn: # ncnn
|
||||||
LOGGER.info(f'Loading {w} for ncnn inference...')
|
LOGGER.info(f'Loading {w} for ncnn inference...')
|
||||||
check_requirements('git+https://github.com/Tencent/ncnn.git' if ARM64 else 'ncnn') # requires NCNN
|
check_requirements('git+https://github.com/Tencent/ncnn.git' if ARM64 else 'ncnn') # requires ncnn
|
||||||
import ncnn as pyncnn
|
import ncnn as pyncnn
|
||||||
net = pyncnn.Net()
|
net = pyncnn.Net()
|
||||||
net.opt.num_threads = os.cpu_count()
|
net.opt.num_threads = os.cpu_count()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user