I have two MLModels in my app. The first one is generating an MLMultiArray output which is meant to be used as the second model input.
As I'm trying to make things as performance-best as possible. I was thinking about using VNImageRequestHandler to feed it with the first model output (MLMultiArray) and use Vision resize and rectOfIntersent to avoid converting the first input to an image, crop features, to avoid the need to convert the first output to image, do everything manually and use the regular image initializer.
Something like that:
let request = VNCoreMLRequest(model: mlModel) { (request, error) in
// handle logic?
}
request.regionOfInterest = // my region
let handler = VNImageRequestHandler(multiArray: myFirstModelOutputMultiArray)
Or I have to go through back and forth conversions? Trying to reduce processing delays.
Vision uses images (hence the name ;-) ). If you don't want to use images, you need to use the Core ML API directly.
If the output from the first model really is an image, it's easiest to change that model's output type to an image so that you get a CVPixelBuffer instead of an MLMultiArray. Then you can directly pass this CVPixelBuffer into the next model using Vision.
Related
getMapPackageAtGeoCoordinates: take only 1 value as parameter.
I've a long list of NMAGeoCoordinates and I'm looking for a way to get the "packageId" without doing multiple calls (or using a bounding box as parameter)
UPDATE
My iOS app has a list of routes (hundreds of them) and each route has multiple intermediate points.
For each route should be possible to download the map data offline.
I'm using this api:
https://developer.here.com/documentation/ios-premium/dev_guide/topics/maps-offline-maploader.html
I'm not using the other method based on NMAMapDataPrefetcher because I need to have control over packages installed.
So given a list of NMAGeoCoordinates I need to get a list of possible NMAMapPackage to download.
I can't use the start or destination coordinate because each route can include multiple countries.
I can't call getMapPackageAtGeoCoordinates multiple times to get a complete list of possible countries included in a route (it's to many calls, on the order of tens for each route)
So I'm wondering if there a better way to solve this problem, maybe using a bounding box to get all the NMAMapPackage included in a route.
I've also checked the REST api:
https://developer.here.com/documentation/routing/topics/resource-calculate-route.html
looks like there a way to calculate a route and get a summary of country traversed, usign the RouteAttributeType "summaryByCountry". The response include a field "country" using an ISO 3166-1-alpha-3 format, but there no way to convert this value to an NMAMapPackage id.
There is no other way except you describe to receive NMAMapPackage using geoCoordinates.
This is the only way to use bounding box to download area he needs without multiple invocations.
#interface NMAGeoBoundingBox : NSObject<NSCoding>
+ (nullable instancetype)geoBoundingBoxContainingGeoCoordinates:(nonnull NSArray<NMAGeoCoordinates *> *)coordinates
#interface NMAMapDataPrefetcher : NSObject
- (NSInteger)fetchMapDataForBoundingBox:(nonnull NMAGeoBoundingBox *)boundingBox
error:(NMAPrefetchRequestError *_Nullable)error
NS_SWIFT_NAME(fetchMapDataForBoundingBox(_:error:));
I have a text editor (QTextEdit). Some words in my editor contains additional information attached (namely, two corresponding integer positions in wave file for that word).
They are stored in Python object as custom properties for QTextCharFormat objects (I attach them with code like this: self.editor.textCursor().setCharFormat(QTextCharFormat().setProperty(MyPropertyID, myWordAttachment) )
Unfortunately, if I save my document to html, all of that additional formatting is lost.
So, I want to perform simplest task: to save my document with all of it's formatting,including myWordAttachment (and to load it from disk).
Am I right that Qt5 doesn't have something ready for it, and I have to write all that document's serialization code by myself? (I still hope that where is simple function that did the job)
1.you loop your text every character.
2.and you catch the character and its charFormat()
3.and you get the properties.
4.Because the properties are eventually a value of something, int,str,...
So you get the properties by charFormat().property(1),(2),(3)... or properties()
5.The most important thing is the character's position & the range.You get the position during the 1th loop.
6.When you catch the CharFormats, you insert into something hashable object like list.
& and you don't forget to insert the CharFormats position.
6.you save your document and the position & properties.
My suggestion for your solution.
1.you can get characterCount() by the QTextDocument object.
2.you loop the range of the characterCount()
3.Before doing it, you make a QTextCursor object.
4.you set the textcursor at the first position.(movePosition method & Start moveoperation & KeepAnchor flag)
5.you move the cursor to right one character & Another.
6.you check the character's charFormat() by tc.charFormat() and the tc.position()
7.But it is the time to Think twice. CharFormat is always the bunch of characters.
you probably get some characters of the same CharFormat().
You can prepare for it.I can Think about some way,but... you should set the QCharFormat objectType or propertyId() for specifing the QCharFormat in Advance(during editing your document).Why don't you set the texts into the properties for after saving & loading.I hope you manage to pass here during debugging & tring.
8.if you get a charFormat,and you check the objectType().
9.if the objectType() is the same as Before searched, you pass the search engine without doing anything.
10.The second important thing is that calls clearSelection() each searching.
11.You save your document() as it is html strings.and you save the charFormats() properties.
12.when you load your document(),the html sentence comes back.
and load the properties.
you make QTextCursor and setPosition( the property's position saved in advance.)
you move QTextCursor until the position and you select the target texts.
you adopt the charFormat properties again and the end.
Summary
The important thing how you specify the charFormat().
You can catch the charFormat without any problem.but the charFormat() is adopted in some range.So you must distinguish the range.
1.The targeted texts is set in the QTextCharFormat's property.
2.You have The QTextCursor pass during the same QTextCharFormat's object.
I can Think of them...
I Think it is some helps for you.
I have almost 0 scripting experience with UDK, but I think what I'm trying to do is fairly simple. I want to define a variable in script that I can then access in Kismet.
This is what I have so far:
MyGameInfo.uc looks like this
class MyGameInfo extends UDKGame;
defaultproperties{
PlayerControllerClass=class'MyGameInfo.MyPlayerController'
}
event InitGame( string Options, out string Error )
{
// Call the parent(i.e. GameInfo) InitGame event version and pass the parameters
super.InitGame( Options, Error );
// Unreal Engine 3
`log( "Hello, world!" );
}
MyPlayerController.uc looks like:
class MyPlayerController extends UDKPlayerController;
var() localized string LangText;
defaultproperties{
LangText="asdfasdf";
}
Then, in Kismet I'm using Get Property, with player 0 as the target, attempting to get property LangText. I have the string output going to Draw Text (and yes, I made sure to set a font).
It looks like this:
I feel like I'm really close, but no text shows up in the Draw Text. Any ideas?
Also, why am I trying to do this? For localization purposes. As far as I can tell, there's no easy way in Kismet to use localized strings for Draw Text. My thinking is just to create a localized string for each piece of dialog and then call those strings from Kismet as needed.
You need to make sure you added a Font asset from the content browser in the DrawText properties, and check it is actually placed on the screen (try Offset 0,0 for centered text)
Also, I think that DrawText doesn't work in UTGAME - in case that's your gametype. It works in UDKGame.
And if you have ToggleCinematic mode enabled, then check Disable HUD isn't on.
Test the DrawText with a regular string first...
Try using Player Spawned event instead of Level Loaded, as it may fire too fast for the player to have been added in the game yet.
The main Data Type used by Yahoo Pipes is the [Item], which is RSS feed content. I want to take an RSS's content or sub-element, make it into [Text] (or a number might work), and then use it as an INPUT into a [Module] to build a RSS-URL with specific parameters. I will then use the new RSS-URL to pull more content.
Could possibly use the [URL Builder Module] or some work-around.
The key here is using "dynamic" data from an RSS feed (not user input, or a static data), and getting that data into a Data Type that is compatible (and/or accessible) as an INPUT into a module.
It seems like a vital functionality, but I cannot figure it out. I have tried many, many work-around attempts, with no success.
The Specific API and Methods (if you are interested)
Using the LastFM API.
1st Method: user.getWeeklyChartList. Then pick the "from" (start) and "to" (end) Unix timestamps from 1 year-ago-today.
2nd Method: user.getWeeklyAlbumChart using those specific (and "dynamic") timestamps to pull my top albums for that week.
tl;dr. Build an RSS-URL using specific parameters from another RSS feed's content.
I think I may have figured it out. I doubt it is the best way, but it works. The problem was the module I needed to use didn't have and input node. But the Loop module has an input node, so if I embed the URL builder into the Loop module I can then access sub-element content from the 1st feed to use as parameters to build the URL for the 2nd feed! Then I can just scrap all the extra stuff generated by the Loop, by using Truncate.
Simple situation: I have a server with thousands of pictures on it. I want to create a restful business layer which will allow me to add tags (categories) to each picture. That's simple. I also want to get lists of pictures that match a single tag. That's simple too. But now I also want to create a method that accepts a list of tags and which will return only pictures that match all these tags. That's a bit more complex, but I can still do that.
The problem is this, however. Say, my rest service is at pictures.example.com, I want to be able to make the following calls:
pictures.example.com/Image/{ID} - Should return a specific image
pictures.example.com/Images - Should return a list of image IDs.
pictures.example.com/Images/{TAG} - Should return a list of image IDs with this tag.
pictures.example.com/Images/{TAG}/{TAG} - Should return a list of image IDs with these tags.
pictures.example.com/Images/{TAG}/{TAG}/{TAG} - Should return a list of image IDs with these tags.
pictures.example.com/Images/{TAG}/{TAG}/{TAG}/{TAG}/{TAG} - Should return a list of image IDs with these tags.
etcetera...
So, how do I set up a RESTful web service projects that will allow me to nest tags like this and still be able to read them all? Without any limitations for the number of tags, although the URL length would be a limit. I might want to have up to 30 tags in a selection and I don't want to set up 30 different routing thingies to get it to work. I want one routing thingie that could technically allow unlimited tags.
Yes, I know there could be other ways to send such a list back and forth. Better even, but I want to know if this is possible. And if it's easy to create. So the URL cannot be different from above examples.
Must be simple, I think. Just can't come up with a good solution...
The URL structure you choose should be based on whatever is easy to implement with your web framework. I would expect something like:
http://pictures.example.com/images?tags=tag1,tag2,tag3,tag4
Is going to be much easier to handle on the server, and I can see no advantage to the path segment approach that you are having trouble with.
I assume you can figure out how to actually write the SQL or filesystem query to filter by multiple tags. In CherryPy, for example, hooking that up to a URL is as simple as:
class Images:
#cherrypy.tools.json_out()
def index(self):
return [cherrypy.url("/images/" + x.id)
for x in mylib.images()]
index.exposed = True
#cherrypy.tools.json_out()
def default(self, *tags):
return [cherrypy.url("/images/" + x.id)
for x in mylib.images(*tags)]
default.exposed = True
...where the *tags argument is a tuple of all the /{TAG} path segments the client sends. Other web frameworks will have similar options.