Multiple Layers add in MapMyIndia - mapmyindia-api

How can we add multiple layers in Map? Also, we need to remove particular kml layers from map.
I have added multiple layers adding one by one
kmlLayer=new MapmyIndia.kml(map,kml, {fitBounds:true,async: true});
kml url pass dynamically in this code.

You can add multiple layer as kml with different kml url or data.
To Remove use : kmlLayer.remove(); or in case of array kmlLayer[0].remove()

Related

Using a subset of tfrecord

Is it possible to use an existing tfrecord for one or a subset of the labels which was used to generate it
I'm training several models with the same data each would require only a one or a subset of labels used to originally create the tfrecord. The tfrecord is quite large so I want to about create one for each models subset of labels.
tf.data.Datasets have filter, skip and take methods which you may find useful. Alternatively you could split your original dataset across multiple tfrecord files and create a Dataset based on a subset of those files.
If you are happy to recreate the data using tensorflow_datasets, splits may also give you what you want.

Properly concatenate feature maps in Tensorflow

I am attempting to reproduce a Convolution Neural Network from a research paper using Tensorflow.
There are many times in the diagram where the results of convolutions are concatenated. Currently I am using tf.concat(https://www.tensorflow.org/api_docs/python/tf/concat) along the last axis (representing channels) to concatenate these feature maps. I originally believed that I would want to concatenate along all axes, but this does not seem to be an option in tensorflow. Now I am facing the problem where the paper indicates that tensors(feature maps) of different sizes should be concatenated. tf.concat does not support concatenations of different sizes, so I am wondering if this was the correct command to use in the first place. In summary, what is the correct way to concatenate feature maps(sometimes of different sizes) in tensorflow?
Thank you.
It's impossible and meaningless to concatenate features maps with different sizes.
If you want to concatenate 2 tensors, every dimension except the concatenation one must be equal.
From the image you posted, in fact, you can see that every feature map that gets concatenated, has the same spatial extent (but different depth) of the other one.
If you can't concatenate in that way, probabily that's something wrong in your code, and probably the problem is the lack of padding = valid in the convolution operation.
The problem that you encounter for inception network may be resolved by using padding in convolutional layers to keep the size same. For inception blocks, instead of using "VALID" padding, change it to "SAME" one. So, without requiring any resizing, you can concatenate the outputs.
Alternatively, you can append padding to the feature maps that are going to be concatenated. You can do that by using tf.pad().
If you don't prefer to do this one, you can use tf.image.resize_images function to resize them to same values. However, this is a dirty and computationally expensive approach.
Tensors can only be concatenated along one axis. If you need to concatenate feature maps of different sizes, you must somehow manipulate the sizes of the original tensors.

Feature Pyramid Network with tensorflow/models/object_detection

If I want to implement k = k0 + log2(√(w*h)/224) in Feature Pyramid Networks for Object Detection, where and which file should I change?
Note, this formula is for ROI pooling. W and H are the width and height of ROI, whereas k represents the level of the feature pyramid this ROI should be used on.
*saying the FasterRCNN meta_architecture file of in object_detection might be helpful, but please inform me which method I can change.
Take a look at this document for a rough overview of the process. In a nutshell, you'll have to create a "FeatureExtractor" sub-class for you desired meta-architecture. For FasterRCNN, you can probably start with a copy of our Resnet101 Feature Extractor as a starting point.
The short answer is that the change won't be trivial as we don't currently support cropping regions from multiple layers. Here is an outline of what would need to change if you would like to pursue this anyway:
Generating a new anchor set
Currently Faster RCNN uses a “GridAnchorGenerator” as the first_stage_anchor_generator - instead you will have to use a MultipleGridAnchorGenerator (same as we use in SSD pipeline).
You will have to use a 32^2 anchor box -> for the scales field of the anchor generator, basically you will have to add a .125
You will have to modify the code to generate and crop from multiple layers: to start, look for a function in the faster_rcnn_meta_arch file called "_extract_rpn_feature_maps", which is suggestively named, but currently returns just a single tensor! You will also have to add some logic to determine which layer to crop from based on the size of the proposal (Eqn 1 from the paper)
You will have to finally create a new feature extractor following the directions that Derek linked to.

What is the best way to feed the image+vector dataset to Tensorflow

I am trying to do a Deep Learning project by using Tensorflow.
Each of my data sets contains 2 files( PNGimage file + TXTvectors file ), where are put in different folders as follow:
./data/image/ #Folders contains different size of images
./data/vector/ #Folders contains vectors of corresponding image
#For example: apple.png + apple.txt
The example content of vector shows as follow:
10.0,2.5,5,13
And since image size are different, the resize and some transformation apply on vectors are required. It is important to make sure that I can do these processing during Tensorflow is running. Is there any good way to manage this kind of datasets?
I referred to a lot of basic tutorial however most of them are not so many details about arrange customized data input and output. Please give me some advice!
I recommend you to take a look at TFRecords and queues. Basically the idea is the following: you resize all your images to the same format and store them together with your txt vectors in one TFRecord file. This is done separately before you run your model.
When you create your model you create a queue which reads data from the TFRecord file and feeds it to your model.

Gimp - Easy way to make many layers visible?

In Gimp, I've created a .xcf file that consists of some 200 layers. Some are visible and some not. Now I want to create a picture that consists of all layers, so I have to make all layers visible. Later I'll have to return to the state where some layers are visible and some not. How can I achieve this without clicking several hundred clickboxes for visibility?
Shift+Click on the eye icon (eycon?) of a layer in the layers dialog, or the place where it should be, if the layer is currently invisible.
This will:
make the layer you are clicking visible
make all other layers invisible by the first click, and visible by the next click
See http://docs.gimp.org/2.8/en/gimp-dialogs-structure.html#gimp-layer-dialog
To get back to the previous state, I'd use File->Revert, this discards any changes and reloads the file from disk
But...
... this is Stack Overflow, so we need to do this in code...
I'd suggest to use the Python console in GIMP, Filters->Python-Fu->Console. Assuming the image is the only one you're working on, the following code sets all of its layers to be visible:
pdb.gimp_image_undo_group_start(gimp.image_list()[0])
for layer in gimp.image_list()[0].layers:
layer.visible = True
pdb.gimp_image_undo_group_end(gimp.image_list()[0])
The code's main part is a loop over all layers of the image, setting them to visible. The loop is wrapped into an undo group, allowing for easy undo of all visiblity changes in one single step.
But... Layer groups?
Yes, we're not quite there yet.
If your image uses layer groups, you will notice that the above code will make any layer not in a group and the groups themselves visible, but it won't affect any layer in a group.
We can tell whether a layer we encounter in that for loop is a layer group - pdb.gimp_item_is_group(layer) will return true for those. So while iterating, we could check if the current item is a group, and start iterating over its children.
Python has nifty way for filtering lists (and gimp.Image.layers is one) by an arbitrary boolean filter-expression, and we got one of those, see above.
So instead of complicating our current loop with additional if statements, we can do this:
pdb.gimp_image_undo_group_start(gimp.image_list()[0])
# iterate layer groups
for group in [group for group in gimp.image_list()[0].layers if pdb.gimp_item_is_group(group)]:
# you want a group.name check here to pick a specific group
for layer in group.layers:
layer.visible = True
# iterate non-group layers
for layer in gimp.image_list()[0].layers:
layer.visible = True
pdb.gimp_image_undo_group_end(gimp.image_list()[0])
But... Nested layer groups?
Yes, still not quite there - if you have nested layer groups. The code just above only gets into the first level of groups, and won't affect any layer in a deeply nested group structure.
This is where a recursive procedure will be more useful than iterative loops, so stay tuned for an additional update.