Get geo-coordinates from images while inferencing with a detectron2 model - latitude-longitude

I have trained a detectron2 model with some images. Now, I want to deploy this model on a different set of images. These images are geo-tagged having longitude and latitude. How can I get the coordinates from images while inferencing with the detectron2 model so that I can have the geographic location of the predictions?
I am using google Collaboratory environment to train and deploy the model.
I am using google Collaboratory environment to train and deploy the model.

Related

Tensorflow Object-detection api

How can we draw ground truth boundary box with predicted boundary box at the time of inference by making use of tensorflow object detection api?
How to calculate precision,recall & mAP for object detection using SSD model with KITTI like dataset?
I suggest you see the mentioned following websites :
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md
https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html
if you use a pre-trained model which there are a large list of them in the TensorFlow model garden zoo, you can customize the model as well. another advantage of using TensorFlow models is that the precision of such models are measured previously and you don't need to measure them again as you see in the below picture:
but for the second part of your question, I can say that you can download the LabelImage GUI and use it to create bounding boxes on your train images and feed them to the TensorFlow object-detection-API
How can we draw a ground truth boundary box with a predicted bounding box at the time of inference by making use of TensorFlow object detection API?
Ans: you can draw a bounding box by XML file referred to the image by xml.etree.ElementTree function Extract XML coordinates if you want to draw a ground truth bounding box in the predicted image you can extract xmin,xmax,ymin and ymax in an XML file after that use cv2.rectangle to draw ground truth bounding box in the predicted image
How to calculate precision,recall & mAP for object detection using SSD model with KITTI like dataset?
Ans: in TF2 can use !python model_main_tf2.py --alsologtostderr --model_dir='___' --pipeline_config_path='____' --checkpoint_dir='____' or you can validated by yourself, for example, create the function to calculate IOU

training image datasets for object detection

Which version of YOLO-tensorflow (customised cnn like googlenet) is preferred for traffic science?
If the training datasets are blurred and are with noise is that okay to train or what are the steps to be considered for training dataset images?
You may need to curate your own dataset using frames from a traffic camera and manually tagging images with cars where the passengers' seatbelts are or are not buckled, as this is a very specialized task. From there, you can do data augmentation (perhaps using the Keras ImageDataGenerator class). If a human can identify a seatbelt in an image that is blurred or noisy, a model can learn from it. From there, you can use transfer learning from a pre-trained CNN model like Inception (this is a helpful tutorial for how to do that), or train your own binary classifier with your tagged images, where your inputs are frames of traffic camera video.
I'd suggest that after learning the basics of CNNs with these models, only then should you dive into a more complicated model like yolo.

making model work better for tfmobile/tflite

So I have trained an object detection model with tensorflow.
I retrained the model (ssd_mobilenet_v2) using a data set containing traffic sign with an image size of 1920x1080 each. The trained model worked really well when ran on desktop.
Now when I ran it on mobile using tfMobile, the Model performed poorly. One thing that stood out to me is that the input for the mobile prediction is reduced to 300x300.
How big of an impact is this? Would retraining the model on images with the same size or aspect ratio improve the model accuracy on mobile?
I also feel like my model is way slower than the one provided from the android demo.

Tensorflow object detection: why is the location in image affecting detection accuracy when using ssd mobilnet v1?

I'm training a model to detect meteors within a picture of the night sky and I have a fairly small dataset with about 85 images and each image is annotated with a bounding box. I'm using the transfer learning technique starting with the ssd_mobilenet_v1_coco_11_06_2017 checkpoint and Tensorflow 1.4. I'm resizing images to 600x600pixels during training. I'm using data augmentation in the pipeline configuration to randomly flip the images horizontally, vertically and rotate 90 deg. After 5000 steps, the model converges to a loss of about 0.3 and will detect meteors but it seems to matter where in the image the meteor is located. Do I have to train the model by giving examples of every possible location? I've attached a sample of a detection run where I tiled a meteor over the entire image and received various levels of detection (filtered to 50%). How can I improve this?detected meteors in image example
It could very well be your data and I think you are making a prudent move by improving the heterogeneity of your dataset, BUT it could also be your choice of model.
It is worth noting that ssd_mobilenet_v1_coco has the lowest COCO mAP relative to the other models in the TensorFlow Object Detection API model zoo. You aren't trying to detect a COCO object, but the mAP numbers are a reasonable aproximation for generic model accuracy.
At the highest possible level, the choice of model is largely a tradeoff between speed/accuracy. The model you chose, ssd_mobilenet_v1_coco, favors speed over accuracy. Consequently, I would reccomend you try one of the Faster RCNN models (e.g., faster_rcnn_inception_v2_coco) before you spend a signifigant amount of time preprocessing images.

How can I get access to intermediate activation maps of the pre-trained models in NiftyNet?

I could download and successfully test brain parcellation demo of NiftyNet package. However, this only gives me the ultimate parcellation result of a pre-trained network, whereas I need to get access to the output of the intermediate layers too.
According to this demo, the following line downloads a pre-trained model and a test MR volume:
wget -c https://www.dropbox.com/s/rxhluo9sub7ewlp/parcellation_demo.tar.gz -P ${demopath}
where ${demopath} is the path to the demo folder. Extracting the downloaded file will create a .ckpt file which seems to contain a pre-trained tensorflow model, however I could not manage to load it into a tensorflow session.
Is there a way that I can load the pre-trained model and have access to the all its intermediate activation maps? In other words, how can I load the pre-trained models from NiftyNet library into a tensorflow session such that I can explore through the model or probe certain intermediate layer for a any given input image?
Finally, in NiftyNet's website it is mentioned that "a number of models from the literature have been (re)implemented in the NiftyNet framework". Are pre-trained weights of these models also available? The demo is using a pre-trained model called HighRes3DNet. If the pre-trained weights of other models are also available, what is the link to download those weights or saved tensorflow models?
To answer your 'Finally' question first, NiftyNet has some network architectures implemented (e.g., VNet, UNet, DeepMedic, HighRes3DNet) that you can train on your own data. For a few of these, there are pre-trained weights for certain applications (e.g. brain parcellation with HighRes3DNet and abdominal CT segmentation with DenseVNet).
Some of these pre-trained weights are linked from the demos, like the parcellation one you linked to. We are starting to collect the pre-trained models into a model zoo, but this is still a work in progress.
Eli Gibson [NiftyNet developer]