|
|
|
@ -16,7 +16,7 @@ TensorFlow Lite | `tflite` | yolov8n.tflite |
|
|
|
|
TensorFlow Edge TPU | `edgetpu` | yolov8n_edgetpu.tflite |
|
|
|
|
TensorFlow.js | `tfjs` | yolov8n_web_model/ |
|
|
|
|
PaddlePaddle | `paddle` | yolov8n_paddle_model/ |
|
|
|
|
NCNN | `ncnn` | yolov8n_ncnn_model/ |
|
|
|
|
ncnn | `ncnn` | yolov8n_ncnn_model/ |
|
|
|
|
|
|
|
|
|
Requirements: |
|
|
|
|
$ pip install ultralytics[export] |
|
|
|
@ -89,7 +89,7 @@ def export_formats(): |
|
|
|
|
['TensorFlow Edge TPU', 'edgetpu', '_edgetpu.tflite', True, False], |
|
|
|
|
['TensorFlow.js', 'tfjs', '_web_model', True, False], |
|
|
|
|
['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']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -258,7 +258,7 @@ class Exporter: |
|
|
|
|
f[9], _ = self.export_tfjs() |
|
|
|
|
if paddle: # PaddlePaddle |
|
|
|
|
f[10], _ = self.export_paddle() |
|
|
|
|
if ncnn: # NCNN |
|
|
|
|
if ncnn: # ncnn |
|
|
|
|
f[11], _ = self.export_ncnn() |
|
|
|
|
|
|
|
|
|
# Finish |
|
|
|
@ -401,14 +401,14 @@ class Exporter: |
|
|
|
|
return f, None |
|
|
|
|
|
|
|
|
|
@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 |
|
|
|
|
|
|
|
|
|
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_ts = str(self.file.with_suffix('.torchscript')) |
|
|
|
|
|
|
|
|
|