hi,
I am currently running LSTM on TensorFlow. However, when i switched from keras2 to keras3. code running time has increased 10 times -- it seems there is no GPU acceleration.
Here is my code:
batch size = 256
optimiser = adam
activation = tanh
_______________________________________________
Layer (type) Output Shape Param #
=============================================
input_1 (InputLayer) [(None, 7, 16)] 0
bidirectional (Bidirection (None, 7, 320) 226560
al)
bidirectional_1 (Bidirecti (None, 7, 512) 1181696
onal)
bidirectional_2 (Bidirecti (None, 256) 656384
onal)
dense (Dense) (None, 1) 257
==============================================
Total params: 2064897 (7.88 MB)
Trainable params: 2064897 (7.88 MB)
Non-trainable params: 0 (0.00 Byte)
______________________________________________
This is keras 3.6.0 + tensorflow 2.17.0 + tensorflow-metal 1.1.0 training status:
Training------------
Epoch 1/200
28/681 ━━━━━━━━━━━━━━━━━━━━ 8:13 756ms/step - loss: 0.5901 - mape: 338.6876 - mse: 0.8591
This is keras 2.14.0 + tensorflow 2.14.0 + tensorflow-metal 1.1.0 training status:
Training------------
Epoch 1/200
681/681 [==============================] - 37s 49ms/step - loss: 3.6345 - mape: 499038.7500 - mse: 34.4148 - val_loss: 3.5452 - val_mape: 41.7964 - val_mse: 32.0133 - lr: 0.0010
Is that because keras3 has no GPU support on macos?
Apart from that, if I change LSTM activation from tanh to sigmoid in keras2, it does not have GPU support as well.
My system is 15.0.1 and the code was running on python3.11
I am not sure why these happen.
Thanks
Explore the power of machine learning and Apple Intelligence within apps. Discuss integrating features, share best practices, and explore the possibilities for your app here.
Post
Replies
Boosts
Views
Activity
Hello.
I can't find anything about the SSML that is used in Apple's speech synthesis.
SSML from Google, Amazon and W3C either don't work or work incorrectly.
Where is Apple's documentation for their implementation of SSML?
My iPhone 15 Pro is from Hong Kong (China). I am outside of China and Asia in general. I have never been to China myself and the iPhone was activated in another country. And it is not the EU.
My iPhone's language, Siri and region settings are changed to US English. Updated to iOS 18.1 RC. But Apple Intelligence doesn't show up in the Siri settings.
I'm trying to use the Spatial model to perform Object Tracking on a .usdz file that I create.
After loading the file, which I can view correctly in the console, I start the training.
Initially, I notice that the disk usage on my PC increases. After several GB, the usage stops, but the training progress remains for hours at 0.00% with the message "About 8hr."
How can I understand what the issue is? Has anyone else experienced the same problem?
Thanks
Diego
Hello everyone,
I hope you’re all doing well. I’m not a developer, but I have an idea for an iOS app that I’d love to get your thoughts on. I wanted to share it here to gather feedback from this knowledgeable community and to learn from your expertise.
Idea Overview: Real-Time AI Running Coach for iOS
The concept is an iOS application that provides personalized, real-time running coaching by leveraging on-device data sources and Apple’s latest technologies. The app aims to offer an adaptive and motivating running experience while ensuring user privacy through on-device processing.
Key Features:
• Personalized Coaching:
• Utilize real-time biometric data and personal insights to deliver AI-driven coaching tailored to the user’s mental and physical state.
• Analyze health metrics, activity data, mood check-ins, and more to provide context-based motivational feedback.
• Privacy First:
• All data processing occurs on-device using Apple’s frameworks like Core ML, ensuring no personal data leaves the device.
• Adaptive Motivation:
• Implement Natural Language Processing to analyze user inputs like journal entries or mood check-ins.
• Generate personalized coaching cues based on historical performance and mood trends.
• Performance Enhancement:
• Offer dynamic adjustments to pace, route, and strategy in real time to help improve running performance.
• Seamless integration with Apple Watch for real-time data collection and haptic feedback.
Technologies and Frameworks Involved:
• HealthKit: Access health metrics such as heart rate, distance run, VO₂ max, sleep patterns, etc.
• Core ML: On-device machine learning for real-time data analysis without latency.
• Natural Language Processing: Analyze personal inputs for better coaching personalization.
• Core Motion & Core Location: Track motion data and location services for runs.
• AVFoundation & Speech: Provide real-time voice feedback and coaching cues.
• SiriKit Integration: Allow users to initiate workouts and receive updates via Siri.
Target Audience:
• Runners of all levels seeking personalized coaching that adapts to their mental and physical states.
• Users who prioritize privacy and want AI-driven insights without their data leaving the device.
• Tech-savvy fitness enthusiasts who use iOS devices and Apple wearables.
Questions for the Community:
1. Feasibility: Is this idea technically achievable using current iOS frameworks and technologies?
2. Data Access: Are there limitations in accessing and processing the necessary data on-device, especially regarding privacy and permissions?
3. Potential Challenges: What hurdles might developers face in creating such an app, and how could they be addressed?
4. Advice: As someone without a technical background, what steps would you recommend I take to move this idea forward?
I truly appreciate any feedback or insights you can provide. I’m excited about the potential of this idea but also aware there may be complexities I’m not considering. Thank you for taking the time to read this!
Best regards,
Paul
I had assumed that Apple Intelligence features would not allow users to give thumbs up or down when they are released later this year. But I recently stumbled upon new marketing material for the iPad Mini (A17 Pro), and in an embedded video on the marketing page, it shows the ability to give a thumbs up and down on an Image generated with Image Wand.
https://www.apple.com/ipad-mini/
Was my assumption about non-beta users not being able to submit feedback on the model’s outputs wrong, or was Apple perhaps taking a screen recording of an unreleased beta and forgot to disable the feedback UI? I assume it can’t be the ladder.
Hi,
I'm training a model that should detect a forehand and a backend stroke.
The data looks like this:
activity,timestamp,Acceleration_X,Acceleration_Y,Acceleration_Z,Rotation_X,Rotation_Y,Rotation_Z
forehand,0.0,0.08,-0.08,0.03,0.18,0.26,0.32
I can load it in Create ML but it's showing the acceleration and rotation x,y,z as seperate Doubles and not as one feature.
What do I have to change to make this work?
Thank you
Hi All,
Is it possible to record a video using the Object Capture instead of taking a series of pictures ?
Is it possible to get the bounding box coordinates of the object we capture ?
I am using Apple’s Vision framework with DetectHorizonRequest to detect the horizon in an image. Here is my code:
func processHorizonImage(_ ciImage: CIImage) async {
let request = DetectHorizonRequest()
do {
let result = try await request.perform(on: ciImage)
print(result)
} catch {
print(error)
}
}
After calling the perform method, I am getting result as nil. To ensure the request's correctness, I have verified the following:
The input CIImage is valid and contains a visible horizon.
No errors are being thrown.
The relevant frameworks are properly imported.
Given that my image contains a clear horizon, why am I still not getting any results? I would appreciate any help or suggestions to resolve this issue.
Thank you for your support!
This is the image
Hello,
I’m working on a program that analyzes video files frame by frame to detect human poses in each frame. However, during the process of reading observations from the stream, the analysis frequently stops with the following error:
[LOG_ERROR] /Library/Caches/com.apple.xbs/Sources/MediaAnalysis/VideoProcessing/VCPHumanPoseImageRequest.mm[85]: code -18
[LOG_ERROR] /Library/Caches/com.apple.xbs/Sources/MediaAnalysis/VideoProcessing/VCPHumanPoseImageRequest.mm[178]: code -18
The error was caught and printed using a do-catch block, and here is the output:
Error Domain=NSOSStatusErrorDomain Code=-18 "Error: failed to processImage" UserInfo={NSLocalizedDescription=Error: failed to processImage}
While the do-catch block helps prevent the app from crashing, the frames following the error cannot be analyzed.
I’m hoping to understand the cause of this error, or find a way to skip the problematic frames and continue analyzing the subsequent ones.
My development environment is Xcode Version 16.0 (16A242d) and iOS 18.0.
Thank you for your help. (Attaching my code below.)
let videoProcessor = VideoProcessor(videoURL)
let bodyPoseRequest = DetectHumanBodyPoseRequest()
let asset = AVURLAsset(url: videoURL)
let videoTrack = try await asset.loadTracks(withMediaType: .video).first
let bodyPoseStream = try await videoProcessor.addRequest(bodyPoseRequest)
videoProcessor.startAnalysis()
do {
for try await observations in bodyPoseStream {
guard let observation = observations.first else { continue }
if let timeRange = observation.timeRange {
/// do something...
}
}
} catch {
print("\(error.localizedDescription)")
}
Almost all the functions in Accelerate are for single precision (Float) and double precision (Double) operations. However, I stumbled upon three integer arithmetic functions which operate on Int32 values. Are there any more functions in Accelerate that operate on integer values? If not, then why aren't there more functions that work with integers?
Hey everyone,
I've been updating my code to take advantage of the new Vision API for text recognition in macOS 15. I'm noticing some very odd behavior though, it seems like in general the new Vision API consistently produces worse results than the old API. For reference here is how I'm setting up my request.
var request = RecognizeTextRequest()
request.recognitionLevel = getOCRMode() // generally accurate
request.usesLanguageCorrection = !disableLanguageCorrection // generally true
request.recognitionLanguages = language.split(separator: ",").map { Locale.Language(identifier: String($0)) } // generally 'en'
let observations = try? await request.perform(on: image) as [RecognizedTextObservation]
Then I will process the results and just get the top candidate, which as mentioned above, typically is of worse quality then the same request formed with the old API.
Am I doing something wrong here?
Hi,
I'm working on training a createML object detector model; I've run into an issue that has me stumped - when I reach somewhere between 100,000 and 150,000 iterations my model will stop training and error out.
More Details:
CreateML gives me the error prompt that says it is unable to train the model please delete the model source and start from the beginning or duplicate the model and start from the beginning (slightly paraphrased)
I see the following error in the createML console (my user name and UUIDs have been redacted)
Unable to load model from file:///Users/<my user name>/Library/Caches/com.apple.dt.createml/projects/<UUID HERE>/sessions/checkpoint.sessions/<UUID Here>//training-000132500.checkpoint: Cannot open file:///Users/<my user name>/Library/Caches/com.apple.dt.createml/projects/<UUID Here>/sessions/checkpoint.sessions/<uuid here> //training-000132500.checkpoint/dir_archive.ini for read. Cannot open /Users/<my username>/Library/Caches/com.apple.dt.createml/projects/<UUID>/sessions/checkpoint.sessions/<UUID>//training-000132500.checkpoint/dir_archive.ini for reading
I've gone into my Caches in my Library directory and I see each piece of the file path in finder UNTIL the //training-00132500 piece of the path, so I can at least confirm that createML appears to be unable to create or open the file it needs for this training session.
Technology Used:
Xcode 16
Apple M1 Pro
MacOS 14.6.1 (23G93)
I've also verified that Xcode and terminal have full disk permissions in my system preferences - I didn't see an option to add CreateML to this list.
I've also ensured that my createML project and its data sources are not in iCloud and are indeed local on my desktop.
Lastly, I made more space on my machine, so I should have a little over 1 TB of space.
Has anybody experienced this before? Any advice? I am majorly blocked on this issue, so I hope somebody else can help shed some light on this issue!
Thanks!
I'm experiencing issues with the Core ML Async API, as it doesn't seem to be working correctly. It consistently hangs during the
"03 performInference, after get smallInput, before prediction" part,
as shown in the attached:
log1.txt
log2.txt
Below is my code. Could you please advise on how I should modify it?
private func createFrameAsync(for sampleBuffer: CMSampleBuffer ) {
guard let pixelBuffer = sampleBuffer.imageBuffer else { return }
Task {
print("**** createFrameAsync before performInference")
do {
try await runModelAsync(on: pixelBuffer)
} catch {
print("Error processing frame: \(error)")
}
print("**** createFrameAsync after performInference")
}
}
func runModelAsync(on pixelbuffer: CVPixelBuffer) async
{
print("01 performInference, before resizeFrame")
guard let data = metalResizeFrame(sourcePixelFrame: pixelbuffer, targetSize: MTLSize.init(width: InputWidth, height: InputHeight, depth: 1), resizeMode: .scaleToFill) else {
os_log("Preprocessing failed", type: .error)
return
}
print("02 performInference, after resizeFrame, before get smallInput")
let input = model_smallInput(input: data)
print("03 performInference, after get smallInput, before prediction")
if let prediction = try? await mlmodel!.model.prediction(from: input) {
print("04 performInference, after prediction, before get result")
var results: [Float] = []
let output = prediction.featureValue(for: "output")?.multiArrayValue
if let bufferPointer = try? UnsafeBufferPointer<Float>(output!) {
results = Array(bufferPointer)
}
print("05 performInference, after get result, before setRenderData")
let localResults = results
await MainActor.run {
ScreenRecorder.shared
.setRenderDataNormalized(
screenImage: pixelbuffer,
depthData: localResults
)
}
print("06 performInference, after setRenderData")
}
}
Issue
When triggering an App Intent using assistant schemas from Apple Intelligence (voice or text) the App opens without prompting for search criteria.
How to repeat
This can be repeated in the example provided by Apple here: https://developer.apple.com/documentation/appintents/making-your-app-s-functionality-available-to-siri
Download the sample code
Build and run on Xcode 16.1 beta 3
Target iPhone 15 Pro Max on iOS 18.1 beta 7
Trigger Apple Intelligence
Enter prompt: "Search AssistantSchemasExample"
Expected behaviour
Apple Intelligence should prompt the user for the criteria and provide this to the App so that the experience is seamless for the end-user. Otherwise Assistant Intents are nothing more than deep links to search screens.
Notes
The example uses @AssistantIntent(schema: .photos.search) intent.
And I've found the issue is also present in other search intents:
@AssistantIntent(schema: .system.search)
@AssistantIntent(schema: .browser.search)
Questions
Has anyone managed to get the prompt to appear?
Will this only function on iOS 18.2?
Hi Ty for playing
With apple intelligence enabled I am seeing a 10-15 sec delay in push notification.
This is actually causing issue with my alarm system, door bells and 2FA requests.
I'm using iPhone 16 Pro.
First installed 18.1 Dev beta 5 and AI and noticed this.
When beta 6 was released it continued.
I put in FB15389900.
I‘m excited at the development possibilities presented by Apple Intelligence and have begun imagining retrieval augmented generation use cases. Writing tools suggest that this is possible, but I have not seen any direct statements by Apple regarding use of AFMs for RAG applications. Have any references to APIs or sample code for RAG applications been published?
Can vector embeddings be used in a SwiftData Model?
If yes, are there resources available to learn more about it? or at least a guided step on how to make it work?
WWDC 2024 mentioned that the OCR feature from the Vision framework has support for "Korean, Swedish, and Chinese", but the Swedish support does not seem to be available...
Running either
print(try? VNRecognizeTextRequest().supportedRecognitionLanguages())
or
var ocrRequest = RecognizeTextRequest(.revision3)
print(ocrRequest.supportedRecognitionLanguages)
did not print out Swedish as one of the supported languages, but Korean and Chinese are.
Tested on early versions of iOS 18 developer beta, and the latest version of iOS 18.1 (22B5054e).