mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 13:34:23 +08:00
ultralytics 8.0.137
fix Windows NCNN export bug (#3803)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
38060b3d40
commit
85f191fbc7
@ -31,11 +31,16 @@ RUN python3 -m pip install --upgrade pip wheel
|
|||||||
RUN pip install --no-cache -e '.[export]' thop py-cpuinfo --extra-index-url https://download.pytorch.org/whl/cpu
|
RUN pip install --no-cache -e '.[export]' thop py-cpuinfo --extra-index-url https://download.pytorch.org/whl/cpu
|
||||||
|
|
||||||
# Run exports to AutoInstall packages
|
# Run exports to AutoInstall packages
|
||||||
|
WORKDIR /tmp_exports
|
||||||
RUN yolo export format=edgetpu imgsz=32
|
RUN yolo export format=edgetpu imgsz=32
|
||||||
RUN yolo export format=ncnn imgsz=32
|
RUN yolo export format=ncnn imgsz=32
|
||||||
# Requires <= Python 3.10, bug with paddlepaddle==2.5.0
|
# Requires <= Python 3.10, bug with paddlepaddle==2.5.0
|
||||||
RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle
|
RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle
|
||||||
|
|
||||||
|
# Reset workdir
|
||||||
|
WORKDIR /usr/src/ultralytics
|
||||||
|
RUN rm -rf /tmp_exports
|
||||||
|
|
||||||
# Usage Examples -------------------------------------------------------------------------------------------------------
|
# Usage Examples -------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Build and Push
|
# Build and Push
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
__version__ = '8.0.136'
|
__version__ = '8.0.137'
|
||||||
|
|
||||||
from ultralytics.engine.model import YOLO
|
from ultralytics.engine.model import YOLO
|
||||||
from ultralytics.hub import start
|
from ultralytics.hub import start
|
||||||
|
@ -64,8 +64,8 @@ from ultralytics.cfg import get_cfg
|
|||||||
from ultralytics.nn.autobackend import check_class_names
|
from ultralytics.nn.autobackend import check_class_names
|
||||||
from ultralytics.nn.modules import C2f, Detect, RTDETRDecoder
|
from ultralytics.nn.modules import C2f, Detect, RTDETRDecoder
|
||||||
from ultralytics.nn.tasks import DetectionModel, SegmentationModel
|
from ultralytics.nn.tasks import DetectionModel, SegmentationModel
|
||||||
from ultralytics.utils import (ARM64, DEFAULT_CFG, LINUX, LOGGER, MACOS, ROOT, __version__, callbacks, colorstr,
|
from ultralytics.utils import (ARM64, DEFAULT_CFG, LINUX, LOGGER, MACOS, ROOT, WINDOWS, __version__, callbacks,
|
||||||
get_default_args, yaml_save)
|
colorstr, get_default_args, yaml_save)
|
||||||
from ultralytics.utils.checks import check_imgsz, check_requirements, check_version
|
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.downloads import attempt_download_asset, get_github_assets
|
||||||
from ultralytics.utils.files import file_size
|
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 = 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'))
|
||||||
|
|
||||||
if Path('./pnnx').is_file():
|
pnnx_filename = 'pnnx.exe' if WINDOWS else 'pnnx'
|
||||||
pnnx = './pnnx'
|
if Path(pnnx_filename).is_file():
|
||||||
elif (ROOT / 'pnnx').is_file():
|
pnnx = pnnx_filename
|
||||||
pnnx = ROOT / 'pnnx'
|
elif (ROOT / pnnx_filename).is_file():
|
||||||
|
pnnx = ROOT / pnnx_filename
|
||||||
else:
|
else:
|
||||||
LOGGER.warning(
|
LOGGER.warning(
|
||||||
f'{prefix} WARNING ⚠️ PNNX not found. Attempting to download binary file from '
|
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]
|
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')
|
attempt_download_asset(asset, repo='pnnx/pnnx', release='latest')
|
||||||
unzip_dir = Path(asset).with_suffix('')
|
unzip_dir = Path(asset).with_suffix('')
|
||||||
pnnx = ROOT / 'pnnx' # new location
|
pnnx = ROOT / pnnx_filename # new location
|
||||||
(unzip_dir / 'pnnx').rename(pnnx) # move binary to ROOT
|
(unzip_dir / pnnx_filename).rename(pnnx) # move binary to ROOT
|
||||||
shutil.rmtree(unzip_dir) # delete unzip dir
|
shutil.rmtree(unzip_dir) # delete unzip dir
|
||||||
Path(asset).unlink() # delete zip
|
Path(asset).unlink() # delete zip
|
||||||
pnnx.chmod(0o777) # set read, write, and execute permissions for everyone
|
pnnx.chmod(0o777) # set read, write, and execute permissions for everyone
|
||||||
|
Loading…
x
Reference in New Issue
Block a user