ultralytics 8.0.150 new Apple *.mlpackage export format (#4043)

Co-authored-by: MLBoy_DaisukeMajima <rockyshikoku@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Louis Lac <lac.louis5@gmail.com>
This commit is contained in:
Glenn Jocher
2023-08-08 17:00:42 +02:00
committed by GitHub
parent f5fc807fa7
commit 7dfdb63cde
22 changed files with 95 additions and 59 deletions

View File

@ -68,7 +68,7 @@ class AutoBackend(nn.Module):
| ONNX Runtime | *.onnx |
| ONNX OpenCV DNN | *.onnx dnn=True |
| OpenVINO | *.xml |
| CoreML | *.mlmodel |
| CoreML | *.mlpackage |
| TensorRT | *.engine |
| TensorFlow SavedModel | *_saved_model |
| TensorFlow GraphDef | *.pb |
@ -485,8 +485,13 @@ class AutoBackend(nn.Module):
sf = list(export_formats().Suffix) # export suffixes
if not is_url(p, check=False) and not isinstance(p, str):
check_suffix(p, sf) # checks
url = urlparse(p) # if url may be Triton inference server
types = [s in Path(p).name for s in sf]
name = Path(p).name
types = [s in name for s in sf]
types[5] |= name.endswith('.mlmodel') # retain support for older Apple CoreML *.mlmodel formats
types[8] &= not types[9] # tflite &= not edgetpu
triton = not any(types) and all([any(s in url.scheme for s in ['http', 'grpc']), url.netloc])
if any(types):
triton = False
else:
url = urlparse(p) # if url may be Triton inference server
triton = all([any(s in url.scheme for s in ['http', 'grpc']), url.netloc])
return types + [triton]