Tensorboard in Tensorflow 2.0: Plot activations and gradients of a model - gradient

First of all, in the tensorflow documentation about Tensorboard callback https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/TensorBoard , they are mentioning that you can plot histograms of activations of a model. However, when I use the tensorboard callback with model.fit, no activation is plotted. So my first Question is:
Is there Anything Wrong? Should I be able to do it ? And before anyone asks, I'm sure I'm training the model and calling tensorboard the right way. Everything is fine, except I can't get the activation histograms.
Second Question:
Can you tell me a way to plot the histograms of activations of a model with a custom tensorflow loop? that is, with tf.GradientTape?
Third Question:
Can you tell me a way to plot the histograms of gradients of a model with a custom training loop? that is, with tf.GradientTape?

Related

How to find logos on a website screenshot

I'm looking for a way to check if a given logo appears on a screenshot of a webpage. So basically, I need to be able to find a small predefined image on a larger image that may or may not contain the smaller image. A match could be of a different scale, somewhat different colors. I need to judge occurrence similarity as well. Need some pointers for what to look at, I've never worked with computer vision before.
Simplest yet not simple way to do it is a normal CNN trained on augmented dataset of the logos.
Trying to keep the answer short, Just make a cnn in tensorflow and train your model on tons images of logos with labels on each training image, It's a simple task and a not-very-crafty CNN must be able to get your work done.
CNN- Convolutional Neural Network
Reference : https://etasr.com/index.php/ETASR/article/view/3919

Real-time object tracking in OpenCV

I have written an object classification program using BoW clustering and SVM classification algorithms. The program runs successfully. Now that I can classify the objects, I want to track them in real time by drawing a bounding rectangle/circle around them. I have researched and came with the following ideas.
1) Use homography by using the train set images from the train data directory. But the problem with this approach is, the train image should be exactly same as the test image. Since I'm not detecting specific objects, the test images are closely related to the train images but not essentially an exact match. In homography we find a known object in a test scene. Please correct me if I am wrong about homography.
2) Use feature tracking. Im planning to extract the features computed by SIFT in the test images which are similar to the train images and then track them by drawing a bounding rectangle/circle. But the issue here is how do I know which features are from the object and which features are from the environment? Is there any member function in SVM class which can return the key points or region of interest used to classify the object?
Thank you

Using CRF suite C++ on images

I have been implementing Object Localization and Segmentation of images.
I need to classify different objects on an image and segment the image accordingly.
I implemented a research paper which is as follows:
Make super pixels of the image(done using Slic algorithm)
Classify each super pixel using some annotated images
Also I am using the Support vector machine classifier to classify every super pixel.
Till here my code is working correct. But the next part is improvement of the segmentation using Conditional Random Field which is a graphical model to segment the image. But I have no idea how should I implement this Conditional Random Field model. I need to make a graph between the super pixels which i have done.
There is a CRF suite in C++ of which the link is provided but I do not understand how to use it for images that is what will be my training data for CRF model and which functions should I call of the library(CRF).
Now I would like to Ask how should I go about implementing the Conditional Random Field Suite in C++ on this graph of the Super pixel.
I went through this but I am unable to understand how should I go about it.
http://www.chokkan.org/software/crfsuite/

How to make motion history image for presentation into one single image?

I am working on a project with gesture recognition. Now I want to prepare a presentation in which I can only show images. I have a series of images defining a gesture, and I want to show them in a single image just like motion history images are shown in literature.
My question is simple, which functions in opencv can I use to make a motion history image using lets say 10 or more images defining the motion of hand.
As an example I have the following image, and I want to show hand's location (opacity directly dependent on time reference).
I tried using GIMP to merge layers with different opacity to do the same thing, however the output is not good.
You could use cv::updateMotionHistory
Actually OpenCV also demonstrates the usage in samples/c/motempl.c

stitching aerial images to create a map

I am working on a project to stitch together around 400 high resolution aerial images around 36000x2600 to create a map. I am currently using OpenCV and so far I have obtained the match points between the images. Now I am at a lost in figuring out how to get the matrix transformation of the images so I can begin the stitching process. I have absolutely no background in working with images nor graphics so this is a first time for me. Can I get some advice on how I would approach this?
The images that I received also came with a data sheet showing longitude, latitude, airplane wing angle, altitude, etc. of each image. I am unsure how accurate these data are, but I am wondering if I can use these information to perform the proper matrix transformation that I need.
Thanks
Do you want to understand the math behind the process or just have an superficial idea of whats going on and just use it?
The regular term for "image snitching" is image alignment. Feed google with it and you'll find tons of sources.
For example, here.
Best regards,
zhengtonic
In recent opencv 2.3 release...they implemented a whole process of image stitching. Maybe it is worth looking at.