Construction Notebook for:
YOLO V3 Trained on Open Images Data
Construction Notebook for:
YOLO V3 Trained on Open Images Data
YOLO V3 Trained on Open Images Data
NetModel Access
NetModel Access
This Notebook
This Notebook
NetModel["YOLO V3 Trained on Open Images Data","ConstructionNotebook"]
Untrained Net
Untrained Net
NetModel["YOLO V3 Trained on Open Images Data","UninitializedEvaluationNet"]
Trained Net
Trained Net
NetModel["YOLO V3 Trained on Open Images Data"]
Notes
Notes
These models are based on the original implementation, but differ in the parameter setting for Batch Normalization Layer
Net Construction
Net Construction
Internal Functions
Internal Functions
Encoder Part
In[]:=
Box Decoder Construction
Box Decoder Construction
In[]:=
multiboxObjDecoder[ anchors_, width_, height_ ] := NetChain[{ ReshapeLayer[ { anchors, 606, width, height } ], PartLayer[ { All, 5 } ], LogisticSigmoid, TransposeLayer[ { 3 <-> 1, 1 <-> 2 } ], FlattenLayer[ ] }];multiboxClassesDecoder[ anchors_, width_, height_ ] := NetChain[{ ReshapeLayer[{ anchors, 606, width, height }], PartLayer[ { All, 6 ;; 606 } ], LogisticSigmoid, TransposeLayer[ { 1 <-> 3, 2 <-> 4 } ], FlattenLayer[ 2 ] }];multiboxLocationsDecoder[ layerNo_, anchors_, width_, height_ ] := NetGraph[{ "reshape" -> ReshapeLayer[ { anchors, 606, width, height } ], "cx" -> NetChain[ { PartLayer[ { All,1 } ], LogisticSigmoid, ConstantPlusLayer[ ], ElementwiseLayer[ 608*#/width& ] } ], "cy" -> NetChain[ { PartLayer[ { All, 2 } ], LogisticSigmoid, ConstantPlusLayer[ ], ElementwiseLayer[ 608*(1-#/height)& ] } ], "width" -> NetChain[ { PartLayer[ { All, 3 } ], ElementwiseLayer[ Exp ], ConstantTimesLayer[ ] } ], "height"-> NetChain[ { PartLayer[ { All, 4 } ], ElementwiseLayer[ Exp ], ConstantTimesLayer[ ] } ], "minx" -> ThreadingLayer[ #1-#2/2& ], "miny"-> ThreadingLayer[ #1-#2/2& ], "maxx"-> ThreadingLayer[ #1+#2/2& ], "maxy"-> ThreadingLayer[ #1+#2/2& ], "cat"-> CatenateLayer[], "reshape1" -> ReshapeLayer[ { 4, anchors, width, height } ], "transpose" -> TransposeLayer[ { 3 <-> 1, 4 <-> 2, 3 <-> 4 } ], "flatten" -> FlattenLayer[ 2 ] }, { "reshape"-> { "cx", "cy", "width", "height" }, { "cx", "width" } -> "minx", { "cx","width" } -> "maxx", { "cy", "height" } -> "miny", { "cy", "height" } ->"maxy", { "minx", "miny", "maxx", "maxy" }->"cat", "cat" -> "reshape1", "reshape1" -> "transpose", "transpose" -> "flatten" }];yoloDecoderNet = NetGraph[ Join[ Flatten@Table[ size = 19 * Power[ 2, i ]; "Objectness" <> ToString[ i + 1 ] -> multiboxObjDecoder[ 3, size, size ], "ClassProb" <> ToString[ i + 1 ] -> multiboxClassesDecoder[ 3, size, size ], "Boxes" <> ToString[ i + 1 ] -> multiboxLocationsDecoder[ 1, 3, size, size ] , { i, 0, 2 } ], "ConcatBoxes" -> CatenateLayer[], "ConcatObjectness" -> CatenateLayer[], "ConcatClassProb" -> CatenateLayer[], "boxes" -> ReshapeLayer[ { 22743, 2, 2 } ] ], Join[ NetPort[ "Output1" ] -> { "Objectness1", "ClassProb1", "Boxes1" }, NetPort[ "Output2" ] -> { "Objectness2", "ClassProb2", "Boxes2" }, NetPort[ "Output3" ] -> { "Objectness3", "ClassProb3", "Boxes3" }, "ConcatBoxes" -> "boxes", "boxes" -> NetPort["Boxes"], "ConcatObjectness" -> NetPort["Objectness"], "ConcatClassProb" -> NetPort["ClassProb"] , Table[ "Boxes" <> ToString[ i ], { i, 1, 3 } ] -> "ConcatBoxes", Table[ "Objectness" <> ToString[ i ], { i, 1, 3 } ] -> "ConcatObjectness", Table[ "ClassProb" <> ToString[ i ], { i, 1, 3 } ] -> "ConcatClassProb" ] ];
Final Net
Final Net