Sign inSign up

echizen321/geoestimation_image

By echizen321

Updated almost 6 years ago

estimating geolocation from image

Image
0

1.1K

echizen321/geoestimation_image repository overview

Reference project

https://github.com/TIBHannover/GeoEstimation/tree/tf2

Usage

Run docker-compose up with the b/m docker-compose.yml and test endpoint with b/m API, body and check against expected results

docker-compose.yml
version: '3.3'

services:
    geoestimation:
        ports:
            - '5300:5300'
        container_name: geoestimation
        environment:
            - PORT=5300
            - APP_MODULE=app:app
            - USE_HIERARCHY=false
        volumes:
            - '/home:/home'
        restart: unless-stopped
        image: echizen321/geoestimation_image
docker-compose parameters
  1. MODEL_PATH (default models/tf2_base_M/resnet-v2-101.tf2_base_M-keras.h5)

  2. LABELS_PATH (default None, possible suggestion would meta/im2gps3k_places365.csv): path to ground truth labels (*for ground-truth referencing only)

  3. CONFIDENCE_THRESHOLD (default 0.5): lower-bound threshold for results

  4. USE_HIERARCHY (default false): set to "true" (case-sensitive) if want to use the hierarchy results (combined results of all cell resolution layers) even if it isn't the highest-confidence layer

  5. SG_MODEL_PATH: for searching intra-SG if global models detects country as "Singapore"

  6. SG_CONFIDENCE_THRESHOLD (default 0.5, can be increased with better training): lower-bound threshold for results if searching within SG

API
Endpoint and Body
POST
http://172.17.0.1:5300/GeoEstimation
{
	"fileLocation": "/home/plato/Desktop/few_images/gbtb_inside.jpg",
	[THIS IS OPTIONAL] "threshold": 0.5
}
Expected Output
{
    "results": {
        "latlong": [
            1.284451621125142,
            103.86074515154986
        ],
        "location": "Singapore",
        "ratio_prediction_over_total": [
            1.6994719943872585e-05,
            1.9246462396506705e-08,
            0.7788609941141376,
            0.9999878001172502
        ]
    }
}
Workflow: how the code works

Global classifier builds upon ResNet101V2 + Dense + softmax. During inference, it outputs a latlng which is then reverse-geocoded into a location

[added on 5/6/20] if country detected is "Singapore", another model (trained so far with VGG19 + a few Dense / Dropout layers + softmax) is run to attempt to find a finer area for Singapore

Possible issues: if global classifier doesn't determine Singapore, the finer model will not be used; if global classifier sees Singapore, the finer model will be used (subject to its own threshold as defined above). This may cause inaccurate fine-tuned results if the global classifier is wrong

View list of Singapore locations

Run docker run -it --entrypoint /bin/bash echizen321/geoestimation_image then cat training/singapore_places.txt from the app directory (should be default directory when you enter)

Retrain SG classifier / add others

...

Tag summary

Content type

Image

Digest

Size

4.7 GB

Last updated

almost 6 years ago

docker pull echizen321/geoestimation_image