diff --git a/docker/Dockerfile-python b/docker/Dockerfile-python index 9b437564..5ddb19b1 100644 --- a/docker/Dockerfile-python +++ b/docker/Dockerfile-python @@ -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 exports to AutoInstall packages +WORKDIR /tmp_exports RUN yolo export format=edgetpu imgsz=32 RUN yolo export format=ncnn imgsz=32 # Requires <= Python 3.10, bug with paddlepaddle==2.5.0 RUN pip install --no-cache paddlepaddle==2.4.2 x2paddle +# Reset workdir +WORKDIR /usr/src/ultralytics +RUN rm -rf /tmp_exports + # Usage Examples ------------------------------------------------------------------------------------------------------- # Build and Push diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 3b1aabbc..a507371b 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = '8.0.136' +__version__ = '8.0.137' from ultralytics.engine.model import YOLO from ultralytics.hub import start diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 828c98da..889e56d7 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -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