find where an image is taken
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 underdatabase/search
- check the log file for details
-
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
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
$ .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: 北京市东城区东长安街***内