-
Notifications
You must be signed in to change notification settings - Fork 0
Predicting GPS Coordinates of objects in image using Machine Learning
We have used machine learning algorithms to predict GPS Coordinates of objects in images(Could also be applied to live video streams) but since I had an old PC with no dedicated graphic card I decided to apply it to a set of images. In the darknet directory we run the python script coo_extracter.py from the Linux terminal (Use terminal here rather than python idle for execution)
python3 coo_extracter.py
This will use Yolov3 deep learning model to predict objects in the image and then an extractor will use a self-trained ML algorithm to predict the GPS Co-ordinates of the persons in the boxes (We have limited the algorithm to predict coordinates of Human only and ignore other objects although it could be expanded to other objects ) Upon Running the above GPS Coordinates will be received in the terminal
For dataset preparation a positioned camera free from any kind of movement and rotation was used to take about 20-25 pictures containing a single person.For each picture that person took its GPS Coordinates at his position hence got around 20-25 values
assumed_PHA.csv
is the dataset file and the folder named dataset
inside darknet folder is the the set of images used.
midpntTOcoo.ipynb
This was used to train the algorithm ,The trained files named as dict.pickle and dict1.pickle . Data was divided into train test and results were quite satisfactory.
Basic analysis like correlation between quantities has also been found,Click on the link below to view it
The results achieved were quite good ,another way of creating this data set was to look from approximate Position point in Google maps but that not much an accurate way of doing it but could be utilized if required.I have personally tested it and results were satisfactory-So in short both methods could be deployed depending the situation.This whole process of training and testing could also be termed as calibration. Below shows a picture how we could deploy the second method (as in in case camera is fixed at points() and approximate data values could be extracted)
Verification is an important factor in this because we need to be sure that the model and data set we are using are correct.its called the reverse process(We run the prediction algorithm in reverse) below are the steps and code COOtoMIDpnt.ipynb
- As the training process was done at my house so we open google maps and move to the coordinates of my home
- We select random any coordinates of the ground like shown below
- Copying Coordinates
- if i view it from my home that is the region where our program should plot the center point of rectangle(in green) of the person standing
- We use COOtoMIDpnt to find X-MID point and Y-MID Point by running it two different set of iterations
For X-MID
- For Y-MID
- Now we use
reverse.py
from the repo to find the placement of green pointer by plugging in the MID-X and MID-Y and we get
- Upon Running it will show
Hence We get awesome result! In the above process we have verified by converting GPS Coordinates in to picture frame coordinates (Center point of the ROI rectangle in green) where the person will stand!.