hollance / Forge

A neural network toolkit for Metal
MIT License
1.27k stars 172 forks source link

ETC_BAD_ACCESS code = 10 #14

Closed jordanhart closed 7 years ago

jordanhart commented 7 years ago

Hi!

I wrote my own CNN in the YOLO demo (currently trying to replicate squeezeDet). I changed the model layers in the init and have my weights converted as .bin files in the parameters folder. The only other item changed was labels. When I run I get "ETC_BAD_ACCESS code = 10" on the flags line of "conv = MPSCNNConvolution(device: device, convolutionDescriptor: desc, kernelWeights: weights.pointer, biasTerms: biases?.pointer, flags: .none)"

Photo included below. What could be the issue causing this? Any advice on solving?

Thank you so much!

screen shot 2017-06-20 at 2 33 44 pm screen shot 2017-06-20 at 5 39 49 pm

Edit: My problem is from this line
let output = fire11Result --> Convolution(kernel: (3, 3), channels: 72, stride: (1,1), activation: nil, name: "conv12") //error is caused by this line

The app runs using fire11Result, the second to last layer, as the output.

Any idea?

Thank you!

hollance commented 7 years ago

That sounds like your weights / biases file do not have enough values in them.

jordanhart commented 7 years ago

Thank you so much for helping!

Turns out put the wrong number for the kernel.

jordanhart commented 7 years ago

Also, just for helping other beginners, uploading the weights conversion script I put together for converting a frozen .pb tensor flow model to Forge (did not use fully connected layers but include link where could copy paste that part in). Frozen_tensorflow_model_to_mpscnn.py.zip