|
|
|
@ -64,8 +64,8 @@ from ultralytics.cfg import get_cfg
|
|
|
|
|
from ultralytics.nn.autobackend import check_class_names
|
|
|
|
|
from ultralytics.nn.modules import C2f, Detect, RTDETRDecoder
|
|
|
|
|
from ultralytics.nn.tasks import DetectionModel, SegmentationModel
|
|
|
|
|
from ultralytics.utils import (ARM64, DEFAULT_CFG, LINUX, LOGGER, MACOS, ROOT, __version__, callbacks, colorstr,
|
|
|
|
|
get_default_args, yaml_save)
|
|
|
|
|
from ultralytics.utils import (ARM64, DEFAULT_CFG, LINUX, LOGGER, MACOS, ROOT, WINDOWS, __version__, callbacks,
|
|
|
|
|
colorstr, get_default_args, yaml_save)
|
|
|
|
|
from ultralytics.utils.checks import check_imgsz, check_requirements, check_version
|
|
|
|
|
from ultralytics.utils.downloads import attempt_download_asset, get_github_assets
|
|
|
|
|
from ultralytics.utils.files import file_size
|
|
|
|
@ -412,10 +412,11 @@ class Exporter:
|
|
|
|
|
f = Path(str(self.file).replace(self.file.suffix, f'_ncnn_model{os.sep}'))
|
|
|
|
|
f_ts = str(self.file.with_suffix('.torchscript'))
|
|
|
|
|
|
|
|
|
|
if Path('./pnnx').is_file():
|
|
|
|
|
pnnx = './pnnx'
|
|
|
|
|
elif (ROOT / 'pnnx').is_file():
|
|
|
|
|
pnnx = ROOT / 'pnnx'
|
|
|
|
|
pnnx_filename = 'pnnx.exe' if WINDOWS else 'pnnx'
|
|
|
|
|
if Path(pnnx_filename).is_file():
|
|
|
|
|
pnnx = pnnx_filename
|
|
|
|
|
elif (ROOT / pnnx_filename).is_file():
|
|
|
|
|
pnnx = ROOT / pnnx_filename
|
|
|
|
|
else:
|
|
|
|
|
LOGGER.warning(
|
|
|
|
|
f'{prefix} WARNING ⚠️ PNNX not found. Attempting to download binary file from '
|
|
|
|
@ -425,8 +426,8 @@ class Exporter:
|
|
|
|
|
asset = [x for x in assets if ('macos' if MACOS else 'ubuntu' if LINUX else 'windows') in x][0]
|
|
|
|
|
attempt_download_asset(asset, repo='pnnx/pnnx', release='latest')
|
|
|
|
|
unzip_dir = Path(asset).with_suffix('')
|
|
|
|
|
pnnx = ROOT / 'pnnx' # new location
|
|
|
|
|
(unzip_dir / 'pnnx').rename(pnnx) # move binary to ROOT
|
|
|
|
|
pnnx = ROOT / pnnx_filename # new location
|
|
|
|
|
(unzip_dir / pnnx_filename).rename(pnnx) # move binary to ROOT
|
|
|
|
|
shutil.rmtree(unzip_dir) # delete unzip dir
|
|
|
|
|
Path(asset).unlink() # delete zip
|
|
|
|
|
pnnx.chmod(0o777) # set read, write, and execute permissions for everyone
|
|
|
|
|