Error loading a TF lite format model in ios device for custom object detection - ios

I have trained a custom object detection, using transfer learning based on MobileNetV2. I converted the model to tflite format so that I can run it on my IOS device. However, when I run the model in xcode, I get an error.
2019-08-20 16:11:07.225613+0100 ObjectDetection[5692:1119136]
Initialized TensorFlow Lite runtime.
2019-08-20 16:11:07.280287+0100 ObjectDetection[5692:1119136] [MC]
System group container for
systemgroup.com.apple.configurationprofiles path is
/var/containers/Shared/SystemGroup/systemgroup.com.apple.configu
rationprofiles
2019-08-20 16:11:07.282075+0100 ObjectDetection[5692:1119136] [MC]
Reading from public effective user settings.
**Failed to invoke the interpreter with error: Provided data count
1080000 must match the required count 602112.
Failed to invoke the interpreter with error: Provided data count
1080000 must match the required count 602112.**

Related

Retrieve full device twin data on device twin changed events

I would like to retrieve the full device twin data on the desired device twin or reported property changed. I was trying with below query filter but getting error.
An unknown error occurred while updating your IoT hub. Error Report: Invalid Routing Condition, RouteName:DeviceTwin-RptProp-Changed-dev, ErrorMessage:Message:Syntax error., Location :1:15, :1:22, Severity:Error . If you contact a support representative please include this correlation identifier: 3ef0e2ff-60c1-4133-af86-7e506af86faf, timestamp: 2021-11-29 04:24:01Z, errorcode: IH400104.
SELECT * FROM devices WHERE
is_object($body.properties.desired)
The following should work.
To retrieve desired properties of your devices:
SELECT properties.desired
To retrieve reported properties of your devices:
SELECT properties.reported

What is `NSLocalizedFailureErrorKey` for?

Among the well-documented strings NSLocalizedDescriptionKey, NSLocalizedFailureReasonErrorKey, NSLocalizedRecoveryOptionsErrorKey, and NSLocalizedRecoverySuggestionErrorKey there is also NSLocalizedFailureErrorKey, which lacks any kind of description in documentation. What is it for?
From the header:
FOUNDATION_EXPORT NSErrorUserInfoKey const NSLocalizedFailureErrorKey API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0));
// NSString
A complete sentence (or more) describing what failed. Setting a value for this key in userInfo dictionary of errors received from framework APIs is a good way to customize and fine tune the localizedDescription of an NSError.
As an example, for Foundation error code NSFileWriteOutOfSpaceError, setting the value of this key to "The image library could not be saved." will allow the localizedDescription of the error to come out as "The image library could not be saved. The volume Macintosh HD is out of space." rather than the default (say) “You can't save the file ImgDatabaseV2 because the volume Macintosh HD is out of space."

iOS Dynamically loaded custom fonts in WidgetKit widget extension not working on real device? (simulator is fine)

<TLDR;>; Trying to use a downloaded font via CTFontManagerRegisterFontsForURL in a widget does not work on a real device. (works on simulator). Seems that registering the font works, but there is a permission issue when loading the font
error 14:39:07.672799-0800 chronod [com.x.y.widgetx:widgetx:small:1536744920620481560#148.0/148.0/20.2] reload: could not decode view
error 14:39:07.674984-0800 kernel Sandbox: chronod(2128) deny(1) file-read-metadata /private/var/mobile/Containers/Shared/AppGroup/9B524570-1765-4C24-9E0C-15BC3982F0DC/downloadedFonts/Chewy/Chewy-Regular.ttf
error 14:39:07.675762-0800 kernel Sandbox: chronod(2128) deny(1) file-read-data /private/var/mobile/Containers/Shared/AppGroup/9B524570-1765-4C24-9E0C-15BC3982F0DC/downloadedFonts/Chewy/Chewy-Regular.ttf
</TLDR;>
Project structure is:
App target + widget extension + widget intent extension
All share a common appgroup group.com.x.y.z and all file handling is done using
FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.x.y.z")
so that only the shared container is used.
Using the Main app target, a font "Chewy-Regular.ttf" is downloaded and saved to the shared AppGroup container.
Font can now be loaded via:
CTFontManagerRegisterFontsForURL()
and displayed in a Main App Text view:
Text("Testing...").font(Font.custom("Chewy-Regular", size: 20))
Now add a Widgetkit widget instance that uses this font.
In 'getTimeLine() and getSnapShot() of IntentTimelineProvider we load the font again via CTFontManagerRegisterFontsForURL (this needs to happen again probably because widget runs in a separate process from the main app?).
On simulator, the widget will show the correct font.
BUT
On iPhone7 real device, the widget will show the 'redacted placeholder view'.
I see in the device console :
error 14:39:07.567120-0800 chronod No configuration found for configured widget identifier: D9BF75EE-4A04-441A-8C85-1507F7ECE379
fault 14:39:07.625600-0800 widgetxExtension -[EXSwiftUI_Subsystem beginUsing:withBundle:] unexpectedly called multiple times.
error 14:39:07.672733-0800 chronod Encountered an error reading the view archive for <private>; error: <private>
error 14:39:07.672799-0800 chronod [com.x.y.widgetx:widgetx:small:1536744920620481560#148.0/148.0/20.2] reload: could not decode view
error 14:39:07.674984-0800 kernel Sandbox: chronod(2128) deny(1) file-read-metadata /private/var/mobile/Containers/Shared/AppGroup/9B524570-1765-4C24-9E0C-15BC3982F0DC/downloadedFonts/Chewy/Chewy-Regular.ttf
error 14:39:07.675762-0800 kernel Sandbox: chronod(2128) deny(1) file-read-data /private/var/mobile/Containers/Shared/AppGroup/9B524570-1765-4C24-9E0C-15BC3982F0DC/downloadedFonts/Chewy/Chewy-Regular.ttf
error 14:39:07.708914-0800 chronod [u 8D2C83B3-A6CB-432E-A9D4-9BC8F7056B10:m (null)] [<private>(<private>)] Connection to plugin invalidated while in use.
fault 14:39:07.710284-0800 widgetxExtension -[EXSwiftUI_Subsystem beginUsing:withBundle:] unexpectedly called multiple times.
error 14:39:07.803468-0800 chronod Encountered an error reading the view archive for <private>; error: <private>
It seems that it's a permission issue, and the textview can't access the font file it needs when the widget is rendering.
Notes:
Font is definitely registered because I can see them in
for fontFamily in UIFont.familyNames {
for fontName in UIFont.fontNames(forFamilyName: fontFamily) {
print(fontName)
...
in both the Main App target and the Widget Extension target
If I make make the font part of the app bundle and add to 'Fonts provided by application' , the are loaded absolutely fine in the Main App and the Widget on simulator and iPhone 7 real device.
I do see this error sometimes in the Widget extension target log, don't know if it's related.
widgetxExtension[1385:254599] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x28375b880> (Domain: group.x.y.z, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
I suspected something to do with app groups, so I tried to copy the font into the Widget Extension container and load from there with FileManager.default(), but had the same result.
Please help! Thank you.

Blacklisting audio driver kills ALSA

I am trying to create a simple driver for my PCI sound card in which I will use the ALSA api. And of course I face a problem: I can't make my driver work.
So here are some details:
As I mentioned my sound card is a PCI device. In order to start my driver I had to stop the originally running snd_intel8x0 driver, as it had occupied the device and it was not accessible(the probe function of my driver was never executed). So I blacklisted the snd_intel8x0 driver (added line in /etc/modporbe.d/blacklist.conf).
From this moment on my driver can be started - the probe function is started.
Unfortunately when snd_intel8x0 driver is blacklisted ALSA api also seems to disappear. I observe the following:
when I start my driver I get these errors in dmesg:
[...] alsa: Unknown symbol snd_card_register (err 0)
[...] alsa: Unknown symbol snd_card_create (err 0)
[...] alsa: Unknown symbol snd_card_free (err 0)
[...] alsa: Unknown symbol snd_device_new (err 0)
in file /proc/kallsyms there are no snd* symbols (if the original driver snd_intel8x0 is running all of the above mentioned snd* functions are available in /proc/kallsyms)
there is folder /proc/asound (if snd_intel8x0 is running asound folder is present)
So my questions:
How can I make my PCI audio card use my driver and not snd_intel8x0?
How do I make ALSA available for my driver?
In general: why does ALSA disappear when snd_intel8x0 is blacklisted?
Thank you in advance
Grts, Nedelin
The driver snd-intel8x0 is for Intel and compatible AC'97 controllers.
If you have such a controller, snd-intel8x0 is the correct driver to use.
If your device does require something new, extend the snd-intel8x0 driver.
If you really want to write a replacement for snd-intel8x0, putting the latter into blacklist.conf is the correct way.
You get "unknown symbol" errors when the modules that are currently loaded and the module you are trying to load are not compatible.
When you recompile ALSA, you should unload all snd* modules before loading a new one.

Other causes for DirectShow "no combination of intermediate filters could be found" errors?

I have a Delphi 6 application that uses the DSPACK DirectShow component library. Currently I am getting the error "no combination of intermediate filters could be found" when I attempt to connect the Capture pin on an audio capture device to the Input pin of another filter. I believe I am setting the media formats correctly. I have an error trap and in that trap I query explicitly both pins for the exact media format they are set to in case there is an incongruity. When I do this, both pins come back with the exact same WAV format:
format tag: 1
number of channels: 1
bits per sample: 16
sample rate: 8000
That matches up to what I set both filters to, yet I am getting an error that (usually as far as I know) indicates a format incompatibility. Has anyone run into this error before and knows what I might be doing wrong or what other kinds of tests/inspections I can do?
It turns out the error was being caused by the media format I was returning from my push source audio filter. I had the wrong sub-type and that was triggering the "no combination of intermediate filters could be found" error from DirectShow since the sub-type I was using in my push source filter was incorrect and not compatible with other filters like the Capture filter I was using in my filter graph. See the "UPDATE" note in my thread on media format's for full details:
Correct Media Type settings for a DirectShow filter that delivers Wav audio data?

Resources