Skip to content

Commit 08a434c

Browse files
author
Giorgos Kordopatis-Zilos
authored
Merge pull request #24 from MKLab-ITI/develop
Develop
2 parents 2dcb9ac + 31573d6 commit 08a434c

36 files changed

+2573
-1475
lines changed

README.md

+34-34
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,41 @@
11
Multimedia Geotagging
22
======
33

4-
Contains the implementation of algorithms that estimate the geographic location of multimedia items based on their textual content and metadata. It includes the <a href="http://ceur-ws.org/Vol-1263/mediaeval2014_submission_44.pdf">participation</a> in the <a href="http://www.multimediaeval.org/mediaeval2014/placing2014/">MediaEval Placing Task 2014</a>. The project's paper can be found <a href="http://link.springer.com/chapter/10.1007/978-3-319-18455-5_2">here</a>.
4+
This repository contains the implementation of algorithms that estimate the geographic location of multimedia items based on their textual content. The approach is described in <a href="http://ceur-ws.org/Vol-1436/Paper58.pdf">here</a> and <a href="http://link.springer.com/chapter/10.1007/978-3-319-18455-5_2">here</a>. It was submitted in <a href="http://www.multimediaeval.org/mediaeval2016/placing/">MediaEval Placing Task 2016</a>.
55

66

77

88
<h2>Main Method</h2>
99

1010
The approach is a refined language model, including feature selection and weighting schemes and heuristic techniques that improves the accuracy in finer granularities. It is a text-based method, in which a complex geographical-tag model is built from the tags, titles and the locations of a massive amount of geotagged images that are included in a training set, in order to estimate the location of each query image included in a test set.
1111

12-
The main approach comprises two major processing steps, an offline and an online. A pre-processing step fist applied in all images. All punctuation and symbols are removed (e.g. “.%!&”), all characters are transformed to lower case and then all images from the training set with empty tags and title are filtered.
12+
The main approach comprises two major processing steps, an offline and an online.
1313

1414
<h3>Offline Processing Step</h3>
1515

16+
* Pre-processing
17+
* apply URL decoding, lowercase transformation, tokenization
18+
* remove accents, punctuations and symbols (e.g. “.%!&”)
19+
* discard terms consisting of numerics or less than three characters
20+
1621
* Language Model
1722
* divide earth surface in rectangular cells with a side length of 0.01°
18-
* calculate tag-cell probabilities based on the users that used the tag inside the cell
23+
* calculate term-cell probabilities based on the users that used the term inside the cell
1924

2025
* Feature selection
21-
* cross-validation scheme using the training set only
22-
* rank tags based on their accuracy for predicting the location of items in the withheld fold
23-
* select tags that surpass a predefined threshold
26+
* calculate locality score of every term in the dataset
27+
* locality is based on the term frequency and the neighbor users that have used it in the cell distribution
28+
* the final set of selected terms is formed from the terms with locality score greater than zero
2429

2530
* Feature weighting using spatial entropy
26-
* calculate entropy values applying the Shannon entropy formula in the tag-cell probabilities
27-
* build a Gaussian weight function based on the values of the spatial tag entropy
31+
* calculate spatial entropy values of every term applying the Shannon entropy formula in the term-cell probabilities
32+
* spatial entropy weights derives from a Gaussian weight function over the spatial entropy of terms
33+
* locality weights derives from the relative position in the rank of terms based on their locality score
34+
* combine locality and spatial entropy weight to generate the final weights
2835

2936
<h3>Online Processing Step</h3>
3037

31-
* Language Model based estimation
38+
* Language Model based estimation (prior-estimation)
3239
* the probability of each cell is calculated
3340
* Most Likely Cell (MLC) considered the cell with the highest probability and used to produce the estimation
3441

@@ -46,45 +53,38 @@ The main approach comprises two major processing steps, an offline and an online
4653
In order to make possible to run the project you have to set all necessary argument in <a href="https://github.com/socialsensor/multimedia-geotagging/blob/master/config.properties">configurations</a>, following the instruction for every argument. The default values may be used.
4754

4855

49-
_Input File_
50-
The dataset's records, that are fed to the algorithm as training and test set, have to be in the following format. The different metadatas are separated with _tab_ character.
51-
52-
imageID imageHashID userID title tags machineTags lon lat description
53-
54-
`imageID`: the ID of the image<br>
55-
`imageHashID`: the Hash ID of the image that was provided by the organizers (optional)<br>
56-
`userID`: the ID of the user that uploaded the image<br>
57-
`title`: image's title<br>
58-
`tags`: image's tags<br>
59-
`machineTags`: image's machine tags<br>
60-
`lon`: image's longitude<br>
61-
`lat`: image's latitude<br>
62-
`description`: image's description, if it is provided.
56+
_Input File_<br>
57+
The imput files must be in the same format as <a href="https://webscope.sandbox.yahoo.com/catalog.php?datatype=i&did=67">YFCC100M dataset</a>.
6358

6459

65-
_Output File of the Offline Step_
66-
At the end of the training process, the algorithm creates a folder named `TagCellProbabilities` and inside the folder another folder named `scale_(s)`, named appropriately based on the scale `s` of the language model's cells. The format of this file is the following.
60+
_Output Files_<br>
61+
At the end of the training process, the algorithm creates a folder named `TermCellProbs` and inside the folder another folder named `scale_(s)`, named appropriately based on the scale `s` of the language model's cells. The format of this file is the following.
6762

68-
tag ent-value cell1-lon_cell1-lat>cell1-prob cell2-lon_cell2-lat>cell2-prob...
63+
term cell1-lon_cell1-lat>cell1-prob>cell1-users cell2-lon_cell2-lat>cell2-prob>cell2-users...
6964
70-
`tag`: the actual name of the tag<br>
71-
`ent-value`: the value of the tag's entropy<br>
65+
`term`: the actual name of the term<br>
7266
`cellx`: the x most probable cell.<br>
7367
`cellx-lon_cellx-lat`: the longitude and latitude of center of the `cellx`, which is used as cell ID<br>
74-
`cellx-prob`: the probability of the `cellx` for the specific tag
68+
`cellx-prob`: the probability of the `cellx` for the specific tag<br>
69+
`cellx-users`: the number of users that used the specific term in the `cellx`
7570

76-
The output of the cross-validation scheme is a file named `tagAccuracies_range_1.0` found in the projects directory. The output file contains the tags with their accuracies in the range of 1km and it is used for the feature selection.
71+
The output of the feature weighting scheme is a folder with name `Weights` containing two files one for locality weight and one for spatial entropy weights, namely `locality_weights` and `spatial_entropy_weights`, respectively. Each row contains a term and its corresponding weight, separated with a tab.
7772

78-
The files that are described above are given as input in the Language Model estimation process. During this process, a folder named `resultsLM` and inside that folder two files named `resultsLM_scale(s)`are created, where are included the MLCs of the query images. Every row contains the imageID and the MLC, separated with a `;`, of the image that corresponds in the respective line in the training set. Also, a file named `confidence_associated_tags` is created in root the root directory, containing the confidence and associated tags with the MLC for every query image.
73+
The files that are described above are given as input in the Language Model estimation process. During this process, a folder named `resultsLM` and inside that folder two files named `resultsLM_scale(s)`are created, where are included the MLCs of the query images. Every row contains the imageID and the MLC (tab-separated) of the image that corresponds in the respective line in the test set. Also, a file named `resultsLM_scale(s)_conf_evid` is created in the same folder, containing the confidence and evidences that lead to estimated MLC, for every query image.
7974

8075
Having estimated the MLCs for both granularity grids, the files are fed to the Multiple Resolution Grids technique, which produce a file named `resultsLM_mg(cs)-(fs)`, where `(cs)` and `(fs)` stands for coarser and finer granularity grid, respectively. Every row of this file contains the image id, the MLC of the coarser language model and the result of the Multiple Resolution Grids technique, separated with a `>`.
8176

82-
In conclusion, the file that is created by the Multiple Resolution Grids technique is used for the final processes of the algorithm, Similarity Search. During this process, a folder named `resultSS` is created, containing the similarity values and the location of the images that containing in the MLG of every image in the test set. The final results are saved in the file specified in the arguments, and the records in each row are the ID of the query image, the estimated latitude, the estimated longitude and the distance between the real and the estimated locations, all separated with the symbol `;`.
77+
In conclusion, the file that is created by the Multiple Resolution Grids technique is used for the final processes of the algorithm, Similarity Search. During this process, a folder named `resultSS` is created, containing the similarity values and the location of the images that containing in the MLG of every image in the test set. The final results are saved in the file specified in the arguments, and the records in each row are the ID of the query image, the real longitude and latitude, the estimated longitude and latitude, and they are tab-separated.
8378

84-
<h3>Demo Version</h3>
79+
<h3>Evaluation Framework</h3>
8580

86-
There have been developed a <a href="https://github.com/socialsensor/multimedia-geotagging/tree/demo">demo version</a> and a <a href="https://github.com/socialsensor/multimedia-geotagging/tree/storm">storm module</a> of the approach .
81+
This <a href="https://github.com/MKLab-ITI/multimedia-geotagging/tree/develop/src/main/java/gr/iti/mklab/mmcomms16">pacage</a> contains the implemetations of the sampling strategies described in the <a href="http://dl.acm.org/citation.cfm?doid=2983554.2983558">MMCommons 2016 paper</a>. In order to run the evaluation framework you have to set all necessary argument in <a href="https://github.com/MKLab-ITI/multimedia-geotagging/blob/master/eval.properties">configuration file</a>, following the instruction for every argument. To run the code, the <a href="https://github.com/MKLab-ITI/multimedia-geotagging/blob/master/src/test/java/gr/iti/mklab/main/Evaluation.java">Evaluation class</a> have to be executed.
82+
83+
Additionally, in this <a href="https://github.com/MKLab-ITI/multimedia-geotagging/blob/master/samples/">folder</a>, the <a href="https://github.com/MKLab-ITI/multimedia-geotagging/blob/master/samples/samples.zip">zip file</a> that contains the generated collections from the different sampling strategies and the <a href="https://github.com/MKLab-ITI/multimedia-geotagging/blob/master/samples/building_concepts.txt">file</a> of the building concepts can be found. Keep in mind that the geographical uniform sampling, the user uniform sampling and text diversity sampling generates different files in every code execution because they involve random selections and permutations.
84+
85+
<h3>Demo Version</h3>
8786

87+
There have been developed a <a href="https://github.com/socialsensor/multimedia-geotagging/tree/demo">demo version</a> and a <a href="https://github.com/socialsensor/multimedia-geotagging/tree/storm">storm module</a> of the approach.
8888

8989
<h3>Contact for further details about the project</h3>
9090

config.properties

+4-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Project directory
2-
dir=/media/georgekordopatis/New Volume/placing-task/files/
2+
dir=/home/georgekordopatis/Documents/multimedia-geotagging/images/
33

44
#Processes of the program
55
#Values:
@@ -12,23 +12,9 @@ dir=/media/georgekordopatis/New Volume/placing-task/files/
1212
#all = all the processes
1313
process=train
1414

15-
#Source Data
16-
sFolder=yfcc100m_dataset/
17-
sTrain=mediaeval2014_placing_train
18-
sTest=mediaeval2014_placing_test
19-
hashFile=yfcc100m_hash
20-
21-
#Training and Test folder and file name
22-
trainFile=all_train_set_filtered
23-
testFile=all_test_set
24-
25-
#Filter images of Training set with empty tags and title
26-
#Boolean: true = filter, false = no filter
27-
filter=true
28-
29-
#Tag accuracy threshold and tag frequency threshold
30-
thetaG=0.0
31-
thetaT=1
15+
#Folder that contains the training files and Test set file
16+
trainFolder=/yfcc100m/
17+
testFile=/testset/2016/mediaeval2016_placing_test
3218

3319
#Scale of Grid
3420
#side cell = 10^(-scale) (i.e. scale 2 = 0.01)
@@ -38,8 +24,6 @@ finerScale=3
3824
#Total number of the similar images (k) and the result files of the LM process for multiple grids (input)
3925
#required for IGSS process
4026
k=5
41-
coarserGrid=resultsLM_scale2
42-
finerGrid=resultsLM_scale3
4327

4428
#Name of the final Result File (output)
4529
resultFile=results_G2-3_k

eval.properties

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#Paths to the input Files
2+
testFile=mediaeval2015_placing_test
3+
placeFile=mediaeval2015_placing_test_places
4+
conceptFile=mediaeval2015_placing_test_autotags
5+
resultFile=results
6+
7+
#Sampling Strategy
8+
#GUS <-- Geographical Uniform Sampling
9+
#UUS <-- User Uniform Sampling
10+
#TBS <-- Text-based Sampling
11+
#TDS <-- Text Diversity Sampling
12+
#GFS <-- Geographically Focused Sampling
13+
#ABS <-- Ambiguity-based Sampling
14+
#VS <-- Visual Sampling
15+
#BS <-- Building Sampling
16+
#(Empty) <-- No sampling
17+
sampling=GUS
18+
19+
#Minimum and Maximum precision range
20+
#precisionrange = 10^(scale) (i.e. scale -1 --> range 0.1km)
21+
minRangeScale=-2
22+
maxRangeScale=3

pom.xml

+10-4
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,17 @@
6363
<artifactId>commons-math3</artifactId>
6464
<version>3.4.1</version>
6565
</dependency>
66-
66+
6767
<dependency>
68-
<groupId>org.apache.commons</groupId>
69-
<artifactId>commons-lang3</artifactId>
70-
<version>3.4</version>
68+
<groupId>info.debatty</groupId>
69+
<artifactId>java-lsh</artifactId>
70+
<version>0.10</version>
71+
</dependency>
72+
73+
<dependency>
74+
<groupId>net.sf.geographiclib</groupId>
75+
<artifactId>GeographicLib-Java</artifactId>
76+
<version>1.42</version>
7177
</dependency>
7278

7379
</dependencies>

samples/building_concepts.txt

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
flying buttress
2+
brussels carpet
3+
capitol
4+
rose window
5+
abbey
6+
coliseum
7+
nave
8+
cathedral
9+
pantheon
10+
chateau
11+
belfry
12+
gothic
13+
temple
14+
aisle
15+
pointed arch
16+
rotunda
17+
organ loft
18+
onion dome
19+
palace
20+
bastion
21+
campanile
22+
cloister
23+
dome
24+
clock tower
25+
roman arch
26+
round arch
27+
amphitheater
28+
church
29+
facade
30+
frieze
31+
ceiling
32+
ballpark
33+
gargoyle
34+
colonnade
35+
manor
36+
altar
37+
battlement
38+
corbel
39+
castle
40+
brownstone
41+
mansion
42+
fortification
43+
pediment
44+
row house
45+
pedestal
46+
acropolis
47+
apartment
48+
building complex
49+
skyscraper
50+
stronghold
51+
monument
52+
fortress
53+
great hall
54+
tower
55+
drawbridge
56+
arch
57+
portico
58+
stadium
59+
field house
60+
condominium
61+
fort
62+
steeple
63+
steel arch bridge
64+
memorial
65+
column
66+
gable
67+
stained
68+
dome building
69+
watchtower
70+
marina
71+
city
72+
support column
73+
concrete
74+
cantilever bridge
75+
building
76+
roof
77+
door knocker
78+
building structure
79+
department store
80+
cityscape
81+
bazaar
82+
casino
83+
baluster
84+
auditorium
85+
hall
86+
truss
87+
brickwork
88+
assembly hall
89+
harbor
90+
radome
91+
architecture
92+
warehouse
93+
chandelier
94+
house
95+
window box
96+
ruins
97+
greenhouse
98+
stairwell
99+
window
100+
lighthouse
101+
mezzanine
102+
country house
103+
library
104+
stairs
105+
bookshop
106+
waterfront
107+
cemetery
108+
villa
109+
rafter
110+
stoop
111+
resort
112+
brick
113+
bannister
114+
mantel
115+
wall
116+
loft
117+
shelter
118+
cafeteria
119+
farmhouse
120+
cabin

samples/samples.zip

67.4 MB
Binary file not shown.

0 commit comments

Comments
 (0)