I am quite new to this platform so please be kind if my question is stupid. Currently I am trying to integrate a deep learning model by using SNPE to detect human pose. The architecture of the model is as following:
Input -> CNN layers -> seperate to two different set of CNN -- > 2 different output layers
So, basically my network is stated from an input data and then genertates two different outputs (output1 and output2), but when I try to execute the network in SNPE, It seems like only have information about the output2 layer. Do any of you has any idea about this situation and is it possipole for me to look for the output of output1. Thank you all in Advance!.
I assume you have successfully converted the model to DLC and are trying to run the network with snpe-net-run tool. For getting multiple outputs, while running snpe-net-run you need to specify the output layers (in addition to input) in the file that is given to --input_list argument.
Let's assume outputlayer1 and outputlayer2 are the names of 2 output layers and ~/test/example_input.raw is the path of the input, then the input list file format for the same is as follows:
#outputlayer1 outputlayer2
~/test/example_input.raw
In the first line # is followed by output layer names which are separated by a whitespace. Next line contains the path to input(single input case). You can also add multiple input files, one line per iteration. If there is more than one input per iteration, a whitespace should be used as a delimiter.
General format for input list file is as follows
#<output_name>[<space><output_name>]
<input_layer_name>:=<input_layer_path>[<space><input_layer_name>:=<input_layer_path>]
β¦
You can refer to snpe-net-run documentation for more information.
Related
I'm trying to use the model used on this tutorial in an Android app. I wanted to modify DetectorActivity.java and TensorFlowMultiBoxDetector.java found here but it seems like i miss some parameters as imageMean, imageStd, inputName, outputLocationsName and outputScoresName.
From what I understand, input name is the name of the input for the model and both outputs are the names for the position and score output, but what do imageMean and imageStd stand for ?
I don't need to use the model with a camera, I just need to detect objects on bitmaps.
Your understanding of input/output names seems correct. They are tensorflow node names that can receive input and will contain the outputs at the end. imageMean and imageStd are used to scale the RGB values of the image to the mean of 0 and the standard deviation of 1. See the 8 lines starting from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/src/org/tensorflow/demo/TensorFlowMultiBoxDetector.java#L208
The TensorFlow android demo app you are referring to has been updated. It now supports MobileNets. Check it out at github: commit 53aabd5cb0ffcc1fd33cbd00eb468dd8d8353df2.
I am trying to build an android app that the user can enter a string, and a list emoji related to that string would show up. (Just like Venmo app) For example:
case 1: User enters "pizz", and in the list there would be "π", note that the users enter "pizz", not pizza!
case 2: User enters "rabb", and in the list there would be "π" and "π°", note that the users enter "rabb", not rabbit!
What would be a good data structure and algorithm for this problem?
A trie is what your looking for. From Wikipedia
A trie, also called digital tree and sometimes radix tree or prefix tree (as they can be searched by prefixes), is a kind of search treeβan ordered tree data structure ...
A trie is similar to a HashMap<K,V>, you can perform a lookup with keys and get a value. The difference is that you can also search by prefix. Given a prefix, it will find all the key-value pairs in the structure that have that prefix. It's basically the data structure for generating search suggestions.
General Idea:
Trie<String, String> t = new Trie<String, String>();
t.insert("pizza", "π");
t.insert("rabbit1", "π");
t.insert("rabbit2", "π°");
// then later...
t.findByPrefix("rabb"); // [π,π°]
Unfortunately, tries are too generic and are not present in any popular data structure libraries (like Java Collections Framework or Google Guava, for example). You'd have to implement one yourself or find an existing implementation and modify it.
I'd recommend:
Learning the theory. Watch this video. There are many more on YouTube that will teach you the basics. You can also search google for "N-way trie" and read notes about it.
Taking this class TrieST and modifying it. It's very similar (or already perfect) for what you need: http://algs4.cs.princeton.edu/52trie/TrieST.java.html see specifically thekeysWithPrefix method.
a newbie to Meteor, but I have created under localhost a simple passenger counter I intend to use on an android app for a passenger survey (holding a laptop in an airport isn't a particularly wise idea). It works, but there is no export function. Basically uses meteor.collection as simple rows of data - one row been one passenger with a date/time stamp, two buttons - Add Passenger and Reset. I have tried looking everywhere for a simple answer, but what I want to do is now add to the client side (on browser - but ultimately on the mobile) a button called export, and when clicked, takes each row in the meteor.collection and export it to a text file - line by line. Very simple. Alas right now I haven't got a clue how to proceed. Seen some references to FS.collection, but don't think there is what I want. This is ultimately for a mobile application.
Thanks.
JSON.stringify each object into a larger object of pure text, say bytes
Create a blob from that text object, ex: blob = new Blob([bytes]);
Use the filesaver package to save to a file locally.
In my project I have one requirement to show the number of pages in Word documents (.doc, .docx) files and number of sheets in Excel documents (.xls, .xlsx). I have tried to read the .docx file using Docx4j but the performance is very poor but I need just the word count and tried using Apache POI. I am getting an error, something like:
"trouble writing output: Too many methods: 94086; max is 65536. By package:"
I want to know whether there is any paid/open source library available for android.
There is just no way to show exact number of pages in MS Word file, because it will be different for different users. The exact number depends on printer settings, paper settings, fonts, available images, etc.
Still, you can do the following for binary files:
open file use POIFSFileSystem or NPOIFSFileSystem
extract only FileInformationBlock as it is done in the constructor HWPFDocumentCore
create DocumentProperties using information from FileInformationBlock as it is done in constuctor of HWPFDocument
get value of property cPg of DOP: DocumentProperties::getCPg()
The description of this field is: "A signed integer value that specifies the last calculated or estimated count of pages in the main document, depending on the values of fExactCWords and fIncludeSubdocsInStats."
For DOCX/XLSX documents you will need to access the same (I assume) property but using SAX or StAX methods.
I am writing a dictionary-type app. I have a list of hash-mapped terms and definitions. The basic premise is that there is a list of words that you tap on to see the definitions.
I have this functionality up and running - I am now trying to put dynamic links between the definitions.
Example: say the user taps on an item in the list, "dog". The definition might pop up, saying "A small furry [animal], commonly kept as a pet. See also [cat].". The intention is that the user can click on the word [animal] or [cat] and go to the appropriate definition. I've already gone to the trouble of making sure that any links in definitions are bounded by square brackets, so it's just a case of scanning the pop-up string for text [surrounded by brackets] and providing a link to that definition.
Note that definitions can contain multiple links, whilst some don't contain any links.
I have access to the string before it is displayed, so I guess the best way to do this is to do the scanning and ready the links before the dialog box is displayed.
The question is, how would I go about scanning for text surrounded by square brackets, and returning the text contained within those brackets?
Ideally the actual dialog box that is displayed would be devoid of the square brackets, and I need to also figure out a way of putting hyperlinks into a dialog box's text, but I'll cross that bridge when I come to it.
I'm new to Java - I've come from MATLAB and am just about staying afloat, but this is a less common task than I've had to deal with so far!
You could probably do this with a regular expression; something like this:
([^[]*)(\[[^]]+\])
which describes two "match groups"; the first of which means any string of zero or more characters that aren't "[" and the second of which means any string starting with "[", containing one or more characters that aren't "]", and ending with "]".
Then you could scan through your input for matches to this pattern. The first match group is passed through unchanged, and the second match group gets converted to a link. When the pattern stops matching your input, take whatever's left over and transmit that unchanged as well.
You'll have to experiment a little; regular expressions typically take some debugging. If your link text can only contain alphanumerics and spaces, your pattern would look more like this:
([^[]*)(\[[\s\w]+\])
Also, you may find that regular expression matching under Android is too slow to be practical, in which case you'll have to use wasyl's suggestion.
Quite simple, I think... As the text is in brackets, you need to scan every letter. So the basic recipe would be :
in a while loop scan every character (let's say, while i < len(text))
If scanned character is [:
i++;
Add letter at index i to some temporary variable
while (character # i) != ']' append it to the temporary variable
store this temporary variable in a list of results.
Some tips:
If you use solution above, use StringBuilder to append text (as regular string is immutable)
You might also want (and it's better, I think) to store starting and ending positions of all square brackets first, and then use string.substring() on each pair to get the text inside. This way you'd first iterate definition to find brackets (maybe catch unmatched ones, for early error handling), then iterate pairs of indices...
As for links, maybe this will be of use: How can I get clickable hyperlinks in AlertDialog from a string resource?