Skip to content
find where an image is taken
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cbir
imgcollector
query/query
.gitignore
.ycm_extra_conf.py
LICENSE
README.md
img2location.py
requirements.txt

README.md

img2location

find where an image is taken

how it works

this is a toy project, which uses resnet (mostly) to compare your input image with selected range of street view images, effectively get a possible address of the input image.

basically:

  • input image looks like ./query/query-class/query.jpg
  • street views downloaded from -q query_string -r region is put under database/search
  • check the log file for details

FAQ

  • Q: why do you need to "query" for street views from baidu map? A: yeah it doesnt make sense, if you already knew what to query, why bother using this tool?. well first, i dont have a beast-like machine for resnet computing, if i downloaded thousands of images and comparing them with my input, im afraid its not possible. second, if there are some store fronts in your picture, you can use them to narrow down query range, which in turn reduces the time cost. anyways, consider this a demo

  • Q: baidu map doesnt have much resources to locate my pic A: Google's place photos api might be a good choice too

how to make it more useful

yeah it can be pretty useful, for private detectives, or cops, or, stalkers

if you want better performance, consider the following:

  • a huge street view resource, better without downloading, my toy has taken care of image caching, in case you dont know
  • a GPU server maybe
  • distributed searching is also worth a shot

demo

$ .venv/bin/python img2location.py -q 天安门 -r 北京 -v
[*] Requesting images from baidu map...
[*] CBIR working...

[+] query: query/query-demo/天安门.jpg

database/search/天安门---北京市东城区长安街.jpg:        0.0,    Class search
database/search/外金水桥---北京市东城区东长安街天安门内.jpg:    0.12019465118646622,    Class search
database/search/青云片兰室---天安门地区管理委员会附近.jpg:      0.23571714758872986,    Class search
database/search/天安门服务部---广场东侧路44号附近.jpg:  0.2933036684989929,     Class search
database/search/天安门-华表---北京市东城区东长安街天安门内.jpg: 0.31151291728019714,    Class search

Matching address:
0.0: 北京市东城区长安街

Matching address:
0.12019465118646622: 北京市东城区东长安街天安门内

Matching address:
0.23571714758872986: 天安门地区管理委员会附近

Matching address:
0.2933036684989929: 广场东侧路44号附近

Matching address:
0.31151291728019714: 北京市东城区东长安街天安门内

acknowledgement

You can’t perform that action at this time.