forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS] Add SpeechRecognition example (#9)
Add an iOS speech recognition example that uses the Wav2Vec 2.0 model.
- Loading branch information
Showing
29 changed files
with
1,250 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,49 @@ | ||
jobs: | ||
- job: BasicUsageIos | ||
pool: | ||
vmImage: "macOS-10.15" | ||
|
||
steps: | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: '3.6' | ||
addToPath: true | ||
architecture: 'x64' | ||
|
||
- script: | | ||
set -e | ||
pip install -r ../model/requirements.txt | ||
../model/gen_model.sh ./OrtBasicUsage/model | ||
workingDirectory: mobile/examples/basic_usage/ios | ||
displayName: "Generate model" | ||
- task: CocoaPods@0 | ||
inputs: | ||
workingDirectory: 'mobile/examples/basic_usage/ios' | ||
forceRepoUpdate: false | ||
|
||
- task: Xcode@5 | ||
inputs: | ||
actions: 'test' | ||
configuration: 'Debug' | ||
sdk: 'iphonesimulator' | ||
xcWorkspacePath: 'mobile/examples/basic_usage/ios/OrtBasicUsage.xcworkspace' | ||
scheme: 'OrtBasicUsage' | ||
xcodeVersion: 'specifyPath' | ||
xcodeDeveloperDir: '/Applications/Xcode_12.4.app/Contents/Developer' | ||
packageApp: false | ||
destinationPlatformOption: 'iOS' | ||
destinationTypeOption: 'simulators' | ||
destinationSimulators: 'iPhone 8' | ||
jobs: | ||
|
||
# mobile/examples/basic_usage/ios | ||
- job: BasicUsageIos | ||
pool: | ||
vmImage: "macOS-10.15" | ||
|
||
steps: | ||
- template: templates/use-python-step.yml | ||
|
||
- bash: | | ||
set -e | ||
pip install -r ../model/requirements.txt | ||
../model/gen_model.sh ./OrtBasicUsage/model | ||
workingDirectory: mobile/examples/basic_usage/ios | ||
displayName: "Generate model" | ||
- script: pod install | ||
workingDirectory: 'mobile/examples/basic_usage/ios' | ||
displayName: "Install CocoaPods pods" | ||
|
||
- template: templates/xcode-build-and-test-step.yml | ||
parameters: | ||
xcWorkspacePath: 'mobile/examples/basic_usage/ios/OrtBasicUsage.xcworkspace' | ||
scheme: 'OrtBasicUsage' | ||
|
||
# mobile/examples/speech_recognition/ios | ||
- job: SpeechRecognitionIos | ||
pool: | ||
vmImage: "macOS-10.15" | ||
|
||
steps: | ||
- template: templates/use-python-step.yml | ||
|
||
- bash: | | ||
set -e | ||
pip install -r ../model/requirements.txt | ||
../model/gen_model.sh ./SpeechRecognition/model | ||
workingDirectory: mobile/examples/speech_recognition/ios | ||
displayName: "Generate model" | ||
- script: pod install | ||
workingDirectory: 'mobile/examples/speech_recognition/ios' | ||
displayName: "Install CocoaPods pods" | ||
|
||
- template: templates/xcode-build-and-test-step.yml | ||
parameters: | ||
xcWorkspacePath: 'mobile/examples/speech_recognition/ios/SpeechRecognition.xcworkspace' | ||
scheme: 'SpeechRecognition' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
steps: | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: '3.6' | ||
addToPath: true | ||
architecture: 'x64' | ||
displayName: "Use Python 3.6" |
21 changes: 21 additions & 0 deletions
21
ci_build/azure_pipelines/templates/xcode-build-and-test-step.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
parameters: | ||
- name: xcWorkspacePath | ||
type: string | ||
- name: scheme | ||
type: string | ||
|
||
steps: | ||
- task: Xcode@5 | ||
inputs: | ||
actions: 'test' | ||
configuration: 'Debug' | ||
sdk: 'iphonesimulator' | ||
xcWorkspacePath: '${{ parameters.xcWorkspacePath }}' | ||
scheme: '${{ parameters.scheme }}' | ||
xcodeVersion: 'specifyPath' | ||
xcodeDeveloperDir: '/Applications/Xcode_12.4.app/Contents/Developer' | ||
packageApp: false | ||
destinationPlatformOption: 'iOS' | ||
destinationTypeOption: 'simulators' | ||
destinationSimulators: 'iPhone 8' | ||
displayName: "Xcode build and test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,43 @@ | ||
# ONNX Runtime Mobile examples | ||
# ONNX Runtime Mobile Examples | ||
|
||
The following examples demonstrate how to use ONNX Runtime (ORT) Mobile in mobile applications. | ||
These examples demonstrate how to use ONNX Runtime (ORT) Mobile in mobile applications. | ||
|
||
## Basic usage | ||
## General Prerequisites | ||
|
||
These are some general prerequisites. | ||
Examples may specify other requirements if applicable. | ||
Please refer to the instructions for each example. | ||
|
||
### Get the Code | ||
|
||
Clone this repo. | ||
|
||
```bash | ||
git clone https://github.com/microsoft/onnxruntime-inference-examples.git | ||
``` | ||
|
||
### iOS Example Prerequisites | ||
|
||
- Xcode 12.4+ | ||
- CocoaPods | ||
- A valid Apple Developer ID if you want to run the example on a device | ||
|
||
## Examples | ||
|
||
### Basic Usage | ||
|
||
The example app shows basic usage of the ORT APIs. | ||
|
||
- [iOS Basic Usage](examples/basic_usage/ios) | ||
|
||
## Image classification | ||
### Image Classification | ||
|
||
The example app uses image classification which is able to continuously classify the objects it sees from the device's camera in real-time and displays the most probable inference results on the screen. | ||
|
||
- [Android Image Classifier](examples/image_classifications/android) | ||
|
||
### Speech Recognition | ||
|
||
The example app uses speech recognition to transcribe speech from audio recorded by the device. | ||
|
||
- [iOS Speech Recognition](examples/speech_recognition/ios) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,3 @@ cd ${OUTPUT_DIR} | |
|
||
python3 ${DIR}/single_add_gen.py | ||
python3 -m onnxruntime.tools.convert_onnx_models_to_ort . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
onnx==1.9.0 | ||
onnxruntime==1.8.0 | ||
onnx>=1.9.0 | ||
onnxruntime>=1.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
platform :ios, '11.0' | ||
|
||
target 'SpeechRecognition' do | ||
use_frameworks! | ||
|
||
pod 'onnxruntime-mobile-objc' | ||
|
||
target 'SpeechRecognitionTests' do | ||
inherit! :search_paths | ||
end | ||
|
||
end |
Oops, something went wrong.