What is the equivalent cpp function for tf.train.import_meta_graph() in tensorflow? - tensorflow

I need to know the equivalent C++ function for https://www.tensorflow.org/api_docs/python/tf/train/import_meta_graph
Can anyone please help with it?

There is no direct equivalent of tf.train.import_meta_graph() in C++, because its main role is to set up Python data structures that are useful in interpreting the low-level GraphDef that the MetaGraph contains.
There are a couple of related functions that might be useful, however:
In the C API, TF_LoadSessionFromSavedModel() will import a "SavedModel" file, which contains one or more meta graphs, and instantiate a session using it. You can create a saved model in Python using the tf.saved_model.builder.SavedModelBuilder class. See the SavedModel documentation for more details.
In the C++ API, the tensorflow::LoadSavedModel() function serves a similar role.

Related

How to only detect humans in object detection API Tensorflow

I am using tensorflow object detection API to detect objects. It is working fine in my windows system. How can I make changes in it to only detect mentioned objects, for example, I only want to detect humans and not all the objects.
As per the 1st comment in this answer, I have checked the visualization file but didn't find anything related to categories of objects. Then I looked into category_util.py and found out that there is csv file from which all the categories are being loaded but didnt found this csv file in the project. Can anyone please point me into the right direction. Thanks
I assume from your question, that you did not finetune your model yourself, but just used a pretrained one from the model zoo!?
In this case, I think the model already detect humans AND other objects and you want these other objects to disappear!? For doing so, you just have to change your label_map.pbtxt by deleting all classes which you don't need. If you are not sure where to find this file have a look into your .config file and search for label_map_path="PATH".

How to do random access or partial matching on a Flatbuffers binary object in Java?

FlatBuffer supports random access. But I couldn't find any example/tutorial on how to do it in Java.
I looked into this article on how facebook uses FlatBuffer: https://code.facebook.com/posts/872547912839369/improving-facebook-s-performance-on-android-with-flatbuffers/
They are using some FlatBufferHelper class, which I couldn't find anywhere.
"random access" means that in FlatBuffers you can take a buffer of serialized data, and using the accessor functions, access any field of any object inside of it in any order.
To learn how to use it, you want to go here https://google.github.io/flatbuffers/flatbuffers_guide_tutorial.html and select "Java". The article you linked is about FlatBuffers at Facebook, and they may have their own (non-public) code.

In what way is gobject facilitating binding?

On the official website of gobject, we can read:
GObject, and its lower-level type system, GType, are used by GTK+ and most GNOME libraries to provide:
object-oriented C-based APIs and
automatic transparent API bindings to other compiled or interpreted
languages
The first part seems clear to me but not the second one.
Indeed, when talking about gobject and binding, the concept introduced is often gobject-intropspection, but as far as I understand, gobject-introspection can be used to create .gir and .typelib for any documented C library, not only for gobject-based library.
Therefore I wonder what makes gobject particularly binding-friendly.
as far as I understand, gobject-introspection can be used to create .gir and .typelib for any documented C library, not only for gobject-based library.
That's not really true in practice. You can do some very basic stuff, but you have to write the GIR by hand (instead of just running a program which scans the source code). The only ones I'm aware of are those distributed with gobject-introspection (the *.gir files, the *.c files there are to avoid cyclical dependencies), and even those are generally only a fairly small subset of the C API.
As for other features, almost everything in GObject helps… the basic idea is that bindings often need RTTI. There are types like GValue (a simple box to store a value + type information), GClosure (for callbacks), properties and signals describe themselves with GTypes, etc. If you use GObjects (instead of creating a new fundamental type) you get run-time data about inheritance and interfaces, and GObject's odd construction scheme even allows other languages to subclass types declared in C.
The reason g-ir-scanner can't really do much on non-GObject libraries is that all that information is missing. After scanning the source code looking for annotations, g-ir-scanner will actually load the compiled module and use GObject's API to grab this information (which makes cross-compiling painful). In other words, GObject-Introspection is a much smaller project than you think… a huge percentage of the data it needs it gets from the GObject API.

Is there an Interactive Data Language (IDL) procedure for accessing a video/camera source?

I have considered that one might use an external library somehow (e.g.. OPENCV), such as via CALL_EXTERNAL, MAKEDLL or LINKIMAGE, but I wonder if there is a built-in IDL procedure for video/camera access. I did not find such a procedure in the IDL documentation, but perhaps someone is aware of such a procedure having been provided by an IDL community member.
There's nothing built into IDL for doing this. However, you have a couple of options. Like you suggested, you could write a simple DLM using make_dll. Or, if you wait until IDL 8.5, you could use the new Python bridge to call Python routines from within IDL to access a video camera. Hope this helps!
Also check out David Grier's OpenCV wrappers.

How to use Locality Sensitive Hash --LSHKIT

I really need to use LSHKIT for my program to measure the similarity of some high dimensional vectors. there is a library for lsh called lshkit which can be found here: http://lshkit.sourceforge.net/
I am confused to use it. First of all I could not build it so I went to section 3.2 which is "Directly add LSHKIT source to your project"
I put all the src codes in one project and fixed the errors but now I do not know how to use it and compile it for a sample data (which is proposed in the lshkit website)
could you guys please help me to find out how to call the functions and see the results?
thanks
Shameless plug: this implementation of Multi-probe LSH is much easier to use than the C++ library. It also implements LSH Forest.