ResNet-101 Trained on YFCC100m Geotagged Data

Determine the geolocation of a photograph

Released in 2017, this geolocation model classifies the location in which a photo was taken among more than 15,000 predefined locations around the world. The classes correspond to cells extracted from Google's S2 Geometry library.

Number of layers: 344 | Parameter count: 74,405,235 | Trained size: 299 MB |

Training Set Information

Performance

Examples

Resource retrieval

Get the pre-trained net:

In[1]:=
NetModel["ResNet-101 Trained on YFCC100m Geotagged Data"]
Out[1]=

Basic Usage

Obtain an estimate of the latitude and longitude of where a photo was taken:

In[2]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/329374fa-fed7-4929-a905-ef70e26821fd"]
Out[2]=

Show a map of the area corresponding to the position:

In[3]:=
GeoGraphics[position]
Out[3]=

Mark the position on a world map:

In[4]:=
GeoGraphics[GeoMarker[position], GeoRange -> 4000000]
Out[4]=

Multiple Predictions

The net returns a probability distribution over all available locations. Obtain the 50 most probable locations for a given image and plot these locations on the world map, with the size of the location marker proportional to the probability:

In[5]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/ac19a0ac-ac9e-416d-8aef-d01548a14105"]
Out[5]=

Fine Scale Predictions

In places with high population density, very fine-grained predictions are possible. Consider the following four landmarks in Paris:

In[6]:=
landmarks = EntityValue[{Entity["Building", "EiffelTower::5h9w8"], Entity["Building", "TheLouvre::vqy3g"], Entity["Building", "NotreDameCathedral::95fcw"], Entity["Building", "ArcDeTriomphe::92x88"]}, "Image", "EntityAssociation"]
Out[6]=

Predict the locations of the four landmarks and mark the locations on the map:

In[7]:=
GeoListPlot[
 MapThread[
  GeoMarker[#1, #2, "Scale" -> 0.01] &, {NetModel[
     "ResNet-101 Trained on YFCC100m Geotagged Data"][
    Values[landmarks]], Values[landmarks]}], GeoRange -> Quantity[1.5, "Miles"]]
Out[7]=

Compare with the actual locations:

In[8]:=
GeoListPlot[
 Map[GeoMarker[EntityValue[#, "Position"], EntityValue[#, "Image"], "Scale" -> 0.01] &, Keys[landmarks]], GeoRange -> Quantity[1.5, "Miles"]]
Out[8]=

Region Density

Inspect the distribution of the available positions. Display a heat map of the location density on the map:

In[9]:=
GeoHistogram[
 NetExtract[NetModel["ResNet-101 Trained on YFCC100m Geotagged Data"],
    "Output"][["Labels"]], 50, PlotStyle -> Opacity[0.4], ImageSize -> Large]
Out[9]=

Net information

Inspect the number of parameters of all arrays in the net:

In[10]:=
NetInformation[
 NetModel["ResNet-101 Trained on YFCC100m Geotagged Data"], \
"ArraysElementCounts"]
Out[10]=

Obtain the total number of parameters:

In[11]:=
NetInformation[
 NetModel["ResNet-101 Trained on YFCC100m Geotagged Data"], \
"ArraysTotalElementCount"]
Out[11]=

Obtain the layer type counts:

In[12]:=
NetInformation[
 NetModel["ResNet-101 Trained on YFCC100m Geotagged Data"], \
"LayerTypeCounts"]
Out[12]=

Display the summary graphic:

In[13]:=
NetInformation[
 NetModel["ResNet-101 Trained on YFCC100m Geotagged Data"], \
"SummaryGraphic"]
Out[13]=

Export to MXNet

Export the net into a format that can be opened in MXNet:

In[14]:=
jsonPath = Export[FileNameJoin[{$TemporaryDirectory, "net.json"}], NetModel["ResNet-101 Trained on YFCC100m Geotagged Data"], "MXNet"]
Out[14]=

Export also creates a net.params file containing parameters:

In[15]:=
paramPath = FileNameJoin[{DirectoryName[jsonPath], "net.params"}]
Out[15]=

Get the size of the parameter file:

In[16]:=
FileByteCount[paramPath]
Out[16]=

The size is similar to the byte count of the resource object:

In[17]:=
ResourceObject[
  "ResNet-101 Trained on YFCC100m Geotagged Data"]["ByteCount"]
Out[17]=

Requirements

Wolfram Language 11.2 (September 2017) or above

Resource History

Reference