Wolfram Computation Meets Knowledge

Pix2pix Street-Map-to-Photo Translation

Generate a satellite photo from a street map

Released in 2016, this model is an application of a powerful method for general-purpose image-to-image translation using conditional adversarial networks. The automatic learning of the loss function with the adversarial networks technique allows the same paradigm to generalize across a wide range of image translation tasks. The architecture enables an efficient aggregation of features of multiple scales through skip connections with concatenations. This particular model was trained to generate a street map from a satellite photo.

Number of layers: 56 | Parameter count: 54,419,459 | Trained size: 218 MB

Training Set Information

Examples

Resource retrieval

Retrieve the resource object:

In[1]:=
ResourceObject["Pix2pix Street-Map-to-Photo Translation"]
Out[1]=

Get the pre-trained net:

In[2]:=
NetModel["Pix2pix Street-Map-to-Photo Translation"]
Out[2]=

Basic usage

Start with a street map:

In[3]:=

Draw a satellite photo from a street map:

In[4]:=
NetModel["Pix2pix Street-Map-to-Photo Translation"][map]
Out[4]=

Evaluate accuracy

Overlap map and prediction:

In[5]:=
ImageCompose[NetModel["Pix2pix Street-Map-to-Photo Translation"][map],
  SetAlphaChannel[map, 0.6]]
Out[5]=

Compare the generated satellite photo with the actual satellite photo:

In[6]:=
Out[6]=

Export to MXNet

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

In[7]:=
jsonPath = 
 Export[FileNameJoin[{$TemporaryDirectory, "net.json"}], 
  NetModel["Pix2pix Street-Map-to-Photo Translation"], "MXNet"]
Out[7]=

Export also creates a net.params file containing parameters:

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

Get the size of the parameter file:

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

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

In[10]:=
ResourceObject["Pix2pix Street-Map-to-Photo Translation"]["ByteCount"]
Out[10]=

Represent the MXNet net as a graph:

In[11]:=
Import[jsonPath, {"MXNet", "NodeGraphPlot"}]
Out[11]=

Requirements

Wolfram Language 11.2 (September 2017) or above

Reference