This commit allows the model tiny Yolo v2 to be compiled and executed With Gorgonia.
Sadly the execution does not give the expected result:
➜ model_zoo_executor git:(tiny-yolov2) ✗ export MODELDIR=~/Documents/tiny_yolov2
➜ model_zoo_executor git:(tiny-yolov2) ✗ go run main.go -model $MODELDIR/model.onnx -input $MODELDIR/test_data_set_0/input_0.pb -output $MODELDIR/test_data_set_0/output_0.pb
Error Trace: main.go:72
proc.go:200
asm_amd64.s:1337
Error: Max difference between -0.17929432 and 0.056231752 allowed is 0.005, but difference was -0.23552606999874115
Messages: the two tensors should be equal.
exit status 1
According to this blog post the architecture should be:
Layer kernel stride output shape
---------------------------------------------
Input (416, 416, 3)
Convolution 3×3 1 (416, 416, 16)
MaxPooling 2×2 2 (208, 208, 16)
Convolution 3×3 1 (208, 208, 32)
MaxPooling 2×2 2 (104, 104, 32)
Convolution 3×3 1 (104, 104, 64)
MaxPooling 2×2 2 (52, 52, 64)
Convolution 3×3 1 (52, 52, 128)
MaxPooling 2×2 2 (26, 26, 128)
Convolution 3×3 1 (26, 26, 256)
MaxPooling 2×2 2 (13, 13, 256)
Convolution 3×3 1 (13, 13, 512)
MaxPooling 2×2 1 (13, 13, 512)
Convolution 3×3 1 (13, 13, 1024)
Convolution 3×3 1 (13, 13, 1024)
Convolution 1×1 1 (13, 13, 125)
---------------------------------------------
After setting some logs, the architecture of the decoded network is:
+Convolution (3, 3) [1 1] (1, 16, 416, 416)
+MaxPooling (2, 2) [2 2] (1, 16, 208, 208)
+Convolution (3, 3) [1 1] (1, 32, 208, 208)
+MaxPooling (2, 2) [2 2] (1, 32, 104, 104)
+Convolution (3, 3) [1 1] (1, 64, 104, 104)
+MaxPooling (2, 2) [2 2] (1, 64, 52, 52)
+Convolution (3, 3) [1 1] (1, 128, 52, 52)
+MaxPooling (2, 2) [2 2] (1, 128, 26, 26)
+Convolution (3, 3) [1 1] (1, 256, 26, 26)
+MaxPooling (2, 2) [2 2] (1, 256, 13, 13)
+Convolution (3, 3) [1 1] (1, 512, 13, 13)
-MaxPooling (2, 2) [1 1] (1, 512, 14, 14)
-Convolution (3, 3) [1 1] (1, 1024, 14, 14)
-Convolution (3, 3) [1 1] (1, 1024, 14, 14)
-Convolution (1, 1) [1 1] (1, 125, 14, 14)
The last layer using the Maxpool
operator does not give the correct output size.
The padding used is computed from the auto_pad
argument but seems ok (padding is [1,1]
).
It requires more investigation; maybe a bug in Gorgonia.
Note : the computation is slow, but Make it work
, then Make it fast
cc @chewxy