Message Boards Message Boards

Circular Diagram of the Wolfram Neural Net Repository

Posted 4 years ago

enter image description here

enter image description here

The Wolfram Neural Net Repository has published 95 NN models for various TaskTypes by 2019. This circular diagram visualizes the information contained in them.

view of circluar diagram

  • An arc indicates one NN model. The arcs are ordered clockwise from the 12 o'clock position in the order of the year the model was released.
  • The outermost circumference is the TaskType. In addition, the name of NN models is displayed by Tooltip.
  • The inner circumference is the usage status of the Layer function of each NN model. White indicates that the Layer function is not used, and the darker the color, the more frequently the Layer function is used. In addition, the specific usage count is displayed by Tooltip.
  • The innermost circumference is the total number of parameters. The higher the height of the bar graph, the bigger the total number of parameters. In addition, the specific number is displayed by Tooltip.

TaskType

There are 10 TaskTypes. The legend of TaskTypes is at the top left of the figure. The trends are as follows.

  • Top 3 is Classification: 26, Feature Extraction: 18, Image Processing: 18, accounting for 65% of the total 95 models
  • Classification and Feature Extraction are released stably every year
  • Language Modeling, Audio Analysis, Object Detection are recent trends

LayerTypeCounts

In 95 NN models, 36 Layer functions are used. The trends are as follows.

  • The 4 most used Layer functions are BatchNormalizationLayer, ConvolutionLayer, ElementwiseLayer, LinearLayer.
  • "YOLO V2 Trained on MS-COCO Data" and "CapsNet Trained on MNIST Data" use the most types of Layer functions, and they use 14 types of Layer functions.
  • Some models use only one Layer function(EmbeddingLayer), and their TaskType are Feature Extraction(e.g. GloVe).
  • It is difficult to understand from the diagram, but those whose count exceeds 1000 are "Enhanced Super-Resolution GAN Trained on DIV2K, Flickr2K and OST Data" and "Unguided Volumetric Regression Net for 3D Face Reconstruction". The count of BERT that are producing impressive results in language processing is 862. On the other hand, the only NN model "Sketch-RNN Trained on QuickDraw Data" which TaskType is Data Generation makes very interesting inferences even though it uses only 3 Layer functions.

the total number of parameters

The total number of parameters is from the minimum 0.1 M of "Vanilla CNN for Facial Landmark Regression" to the maximum 659 M of "GloVe 300-Dimensional Word Vectors Trained on Common Crawl 840B". There are 23 NN models with a total number of parameters exceeding 100M, which is about 1/4 of all. Feature extraction: 8, classification: 7, semantic segmentation: 6, language modeling: 2.

Get the data

I will explain how to make this circluar diagram.

Create a list consisting of the following elements for all the NN models published in The Wolfram Neural Net Repository.

  • name
  • release year
  • TaskType
  • Total Number of Parameter
  • list of number of Layer functions used in it

    (* Get all the NN models published in the Wolfram Neural Net Repository?*)
    modelnames = NetModel[];
    models = NetModel /@ modelnames;
    (* {name, release year, TaskType,?Total Number of Parameter} *)
    list = {#, NetModel[#, "SourceMetadata"]["Date"], 
         NetModel[#, "TaskType"], 
         NetInformation[NetModel[#], "ArraysTotalElementCount"]} & /@ 
       modelnames;
    

Correct missing data.

(* correct release year from the description of The Wolfram Neural Net Repository *)
list[[First@
    First@Position[modelnames, 
      "ResNet-101 Trained on YFCC100m Geotagged Data"], 2]] = 
  DateObject[{2017}];
list[[First@First@Position[modelnames, "Yahoo Open NSFW Model V1"], 
   2]] = DateObject[{2016}];

(* correct TaskType from the description of The Wolfram Neural Net Repository *)
list[[First@First@Position[modelnames, "LeNet"], 
   3]] = {"Classification"};

(* limited to one TaskType *)
list[[First@
    First@Position[modelnames, 
      "GPT-2 Transformer Trained on WebText Data"], 
   3]] = {"Language Modeling"};
list[[First@
    First@Position[modelnames, 
      "GPT Transformer Trained on BookCorpus Data"], 
   3]] = {"Language Modeling"};
list[[First@
    First@Position[modelnames, 
      "Self-Normalizing Net for Numeric Data"], 
   3]] = {"Classification"};
list[[First@
    First@Position[modelnames, 
      "Wolfram AudioIdentify V1 Trained on AudioSet Data"], 
   3]] = {"Audio Analysis"};

Get a list of number of Layer functions used in NN models

(* Get all the Layer functions used in NN models *)
ltc = NetInformation[#, "LayerTypeCounts"] & /@ models;
apis = Keys[ltc] // Flatten // DeleteDuplicates // Sort;
(* List of number of Layer functions used in each NN model *)
rule = Map[# :> 0 &, apis];
apiscnt = (apis /. # /. rule) &@ltc;

(* {name of NN model, Year, TaskType,?Total Number of Parameter, 
list of number of Layer functions } *)
list2 = Append[list[[#]], apiscnt[[#]]] & /@ Range[Length@models];

Sort the list by release year and TaskType.

(*Sort by year*)
listSortDate = Sort[list2, #1[[2]] < #2[[2]] &];
(* Sort by TaskType *)
gbyear = GroupBy[listSortDate, #[[2]][[1, 1]] &];
sorttype = Sort /@ (#[[All, {3, 1, 2, 4, 5}]] & /@ gbyear);
reorder = (#[[All, {2, 3, 1, 4, 5}]]) & /@ sorttype;
listSortDateTask = Flatten[Values[reorder], 1];

Create circluar diagram

Set parameters independent of TaskType.

(* Background color *)
backcolor = White;
(* Number of Layer functions *)
an = Length@listSortDateTask[[1, -1]]; 
(* List of TaskTypes *)
tasktypes = listSortDateTask[[All, 3]] // DeleteDuplicates // Sort;
(* Number of TaskTypes *)
tn = Length@tasktypes; 
(* inner circle radius of circular diagram *)
R = 10; 
(* Display range of circular diagram *)
c = 1.5 Pi;
(* bar chart ratio of Total Number of Parameter *)
psrate = R/(2 Max[
      listSortDateTask[[All, 4]] /. 
       Indeterminate -> 
        0]);(* Max Total Number of Parameter of all NN models *)
psmax = Max[listSortDateTask[[All, 4]] /. Indeterminate -> 0];

(* colors of Layer functions *)
SeedRandom[1];
col = RandomColor[an];
(* colors of TaskTypes from 12 colors of crayon *)
colt = {RGBColor[1, 1, 0], RGBColor[1, 0.5, 0], RGBColor[0.6, 0.4, 0.2], 
RGBColor[1, 0, 0], RGBColor[1, 0.5, 0.5], RGBColor[0.5, 0, 0.5], 
RGBColor[Rational[157, 255], Rational[4, 5], Rational[224, 255]], 
RGBColor[Rational[181, 255], 1, Rational[4, 51]], RGBColor[0, 1, 0], RGBColor[0, 0, 1]};
(* get color of Layer functions. White if a function is not used *)
Col[n_, cnt_] := If[cnt[[n]] == 0, backcolor, col[[n]]]
(* get opacity of Layer functions depend on number of Layer function *)    
Opa[n_, cnt_] := 
 Which[cnt[[n]] == 0, 1, cnt[[n]] < 10, .1, cnt[[n]] < 100, .5, True, 1]

Define functions.

(* cell for a layer function of a  model *)
cell[r_, {ang1_, ang2_}, col_, opa_, apiname_, apicount_] := {
  (* front *)
  Opacity[opa], col, 
  If[col === backcolor, Disk[{0, 0}, r, {ang1, ang2}], 
   Tooltip[Disk[{0, 0}, r, {ang1, ang2}], 
    ToString[apiname] <> " : " <> ToString[apicount] ]],
  (* background *)
  EdgeForm[{Thickness[0], backcolor}], Opacity[1], backcolor, 
  Disk[{0, 0}, r - 1, {ang1, ang2}]
  }

(* arc for a model *)
Arc[list_, modelno_, mn_] := Module[{theta, apicnt, coltt},
  theta = {Pi/2 - (modelno - 1) c/mn, Pi/2 - modelno c/mn};
  (* list of api count *)
  apicnt = list[[modelno, -1]];
  (* color of TaskType *)
  coltt = 
   colt[[First@First@Position[tasktypes, list[[modelno, 3]]]]];
  Join[
   (* TaskType *)
   {EdgeForm[{Thickness[0], backcolor}], coltt, 
    Tooltip[Disk[{0, 0}, an + R + 1.5, theta], list[[modelno, 1]]]},
   (* background *)
   {EdgeForm[{Thickness[0], backcolor}], backcolor, 
    Disk[{0, 0}, an + R + .5, theta]},
   (* cells of all Layer functions of NN model *)
   cell[an + R + 1 - #, theta, Col[#, apicnt], Opa[#, apicnt], 
      apis[[#]], apicnt[[#]]] & /@ Range[an]
   ]
  ]

(* Total Number of Parameter *)
tnp[list_, modelno_, mn_] := Module[{theta, psize},
  theta = {Pi/2 - (modelno - 1) c/mn, Pi/2 - modelno c/mn};
  psize = list[[modelno, 4]];(* Total Number of Parameter *)
  If[psize === Indeterminate, psize = 0;];
  {Gray, Thickness[.0025], 
   Rotate[Tooltip[
     Line[{{R/2 - 1, 0}, {R/2 - 1 + (R/2) Sqrt[psize/psmax], 0}}], 
     psize], Mean@theta, {0, 0}]} 
  ]

(* circular diagram *)
circulardiagram[tt_: 0] := 
 Module[{listsel, yearnames, yearacc, yearmv, mn},
  (* Parameters dependent of TaskType *)
  listsel = 
   If[tt === 0, listSortDateTask, 
    Select[listSortDateTask, #[[3]] === tt &]];
  mn = Length@listsel ;(* Number of NN Models *)

  (* year information *)
  yearnames = (gb = GroupBy[listsel, #[[2]][[1, 1]] &]) // Keys;
  yearacc = Prepend[(Length /@ gb // Values // Accumulate), 0];
  yearmv = MovingAverage[yearacc, 2];

  Graphics[Join[
    (* NN model *)
    Arc[listsel, #, mn] & /@ Range[mn],
    (* index: name & TaskType *)
    {Text[
      Style["Model name & TaskType   ", Gray, Bold, 6], {0, 
       an + R + 1}, Right]},
    (* index: Layer function name *)
    Text[Style[ToString[apis[[#]]] <> "", Gray, Bold, 6], {-1.5, 
        an + R + 1 - .5 - #}, Right] & /@ Range[an],
    (* index: Layer function color *)
    {EdgeForm[{Thickness[0], col[[#]]}], FaceForm[col[[#]]], 
       Disk[{-1, an + R + 1 - .5 - #}, .3]} & /@ Range[an],
    (* index: Total Number of Parameters *)
    {Text[
      Style["Total Number of Parameters   ", Gray, Bold, 6], {0, 
       R/2 + 2}, Right]},
    (* border line *)
    {LightGray, Thickness[.001], 
       Rotate[Line[{{R, 0}, {an + R + 1, 0}}], 
        Pi/2 - # c/mn, {0, 0}]} & /@ Range[mn],(* release year border line *)
    {LightGray, Thickness[.003], 
       Rotate[Line[{{R, 0}, {an + R + 2, 0}}], 
        Pi/2 - # c/mn, {0, 0}]} & /@ yearacc,
    {EdgeForm[{Thickness[.002], LightGray}], FaceForm[None], 
     Disk[{0, 0}, R, {-Pi, Pi/2}]},
    {EdgeForm[{Thickness[.001], LightGray}], FaceForm[None], 
       Disk[{0, 0}, R + #, {-Pi, Pi/2}]} & /@ Range[an],(* inner circle edge *)
    {EdgeForm[{Thickness[.002], LightGray}], FaceForm[None], 
     Disk[{0, 0}, 
      R/2 - 1, {-Pi, Pi/2}]}, {EdgeForm[{Thickness[0], backcolor}], 
     FaceForm[backcolor], Disk[{0, 0}, R/2 - 1 - .1]},
    (* release year *)
    Text[Style[ToString[yearnames[[#]]], Gray, Bold, 
        11], (an + R + 3) {Cos[tmp = Pi/2 - yearmv[[#]] c/mn], 
         Sin[tmp]}, Center, {Sin[tmp], -Cos[tmp]}] & /@ 
     Range[Length@yearnames],
    (* Total Number of Parameter *)
    tnp[listsel, #, mn] & /@ Range[mn]
    ],
   (* usage guide of TaskTypes *)
   Epilog -> 
    If[tt === 0, 
     Inset[Grid[
       Prepend[Transpose[{colt, 
          Style[#, Bold, Gray, 8] & /@ tasktypes[[All, 1]]}], {Style[
          "Task Type", Bold, Gray, 10], SpanFromLeft}], 
       Alignment -> Left], {-an - R + 8, an + R - 9}],
     Inset[Null]],
   ImageSize -> If[tt === 0, 700, 350], Background -> backcolor,
   PlotLabel -> If[tt === 0, None, Style[First@tt, Gray, Bold, 13]]
   ]
  ]

Create the circular diagram at the top of this post.

circulardiagram[]

enter image description here

Create circular diagram for each TaskType.

Grid[Partition[circulardiagram /@ tasktypes, UpTo[3]], 
 Spacings -> {2, 2}]

enter image description here

Attachments:
POSTED BY: Kotaro Okazaki
4 Replies

Attachment

Attachments:
POSTED BY: Kotaro Okazaki

Dear @Kotaro, this is exceptionally made! Thank you. Could you post a high resolution image so it is easier to read the text?

POSTED BY: Vitaliy Kaurov

Thanks for your comment. I have attached a high resolution image.

Also, display a model name as a tooltip while the mouse pointer is in the image of the attached notebook.

POSTED BY: Kotaro Okazaki

enter image description here - Congratulations! This post is now featured in our Staff Pick column as distinguished by a badge on your profile of a Featured Contributor! Thank you, keep it coming, and consider contributing your work to the The Notebook Archive!

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract