Skip to content

Commit

Permalink
Add mlmodelconfig for patch
Browse files Browse the repository at this point in the history
  • Loading branch information
john-rocky committed Jan 29, 2025
1 parent 7d357ef commit 9c86b93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion YOLO/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>83</string>
<string>85</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
18 changes: 11 additions & 7 deletions YOLO/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ import CoreMedia
import UIKit
import Vision

var mlModel = try! yolo11m(configuration: .init()).model
var mlModel = try! yolo11m(configuration: mlmodelConfig).model
var mlmodelConfig: MLModelConfiguration = {
let config = MLModelConfiguration()
config.setValue(1, forKey: "experimentalMLE5EngineUsage")
return config
}()

class ViewController: UIViewController {
@IBOutlet var videoPreview: UIView!
Expand Down Expand Up @@ -140,24 +145,23 @@ class ViewController: UIViewController {
@IBAction func indexChanged(_ sender: Any) {
selection.selectionChanged()
activityIndicator.startAnimating()

/// Switch model
switch segmentedControl.selectedSegmentIndex {
case 0:
self.labelName.text = "YOLO11n"
mlModel = try! yolo11n(configuration: .init()).model
mlModel = try! yolo11n(configuration: mlmodelConfig).model
case 1:
self.labelName.text = "YOLO11s"
mlModel = try! yolo11s(configuration: .init()).model
mlModel = try! yolo11n(configuration: mlmodelConfig).model
case 2:
self.labelName.text = "YOLO11m"
mlModel = try! yolo11m(configuration: .init()).model
mlModel = try! yolo11n(configuration: mlmodelConfig).model
case 3:
self.labelName.text = "YOLO11l"
mlModel = try! yolo11l(configuration: .init()).model
mlModel = try! yolo11n(configuration: mlmodelConfig).model
case 4:
self.labelName.text = "YOLO11x"
mlModel = try! yolo11x(configuration: .init()).model
mlModel = try! yolo11n(configuration: mlmodelConfig).model
default:
break
}
Expand Down

0 comments on commit 9c86b93

Please sign in to comment.