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

Get the pre-trained net:

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

Basic usage

Start with a street map:

In[2]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/d3c98920-5ed4-4aa3-ab0d-31984a34e913"]

Draw a satellite photo from a street map:

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

Evaluate accuracy

Overlap map and prediction:

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

Compare the generated satellite photo with the actual satellite photo:

In[5]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/a676262c-04cb-4021-9fe7-f02045c18046"]
Out[5]=

Net information

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

In[6]:=
NetInformation[
 NetModel["Pix2pix Street-Map-to-Photo Translation"], \
"ArraysElementCounts"]
Out[6]=

Obtain the total number of parameters:

In[7]:=
NetInformation[
 NetModel["Pix2pix Street-Map-to-Photo Translation"], \
"ArraysTotalElementCount"]
Out[7]=

Obtain the layer type counts:

In[8]:=
NetInformation[
 NetModel["Pix2pix Street-Map-to-Photo Translation"], \
"LayerTypeCounts"]
Out[8]=

Display the summary graphic:

In[9]:=
NetInformation[
 NetModel["Pix2pix Street-Map-to-Photo Translation"], \
"SummaryGraphic"]
Out[9]=

Export to MXNet

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

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

Export also creates a net.params file containing parameters:

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

Get the size of the parameter file:

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

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

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

Represent the MXNet net as a graph:

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

Requirements

Wolfram Language 11.2 (September 2017) or above

Resource History

Reference