Open Techgps1 opened 4 years ago
You should probably change this line,
let pointer = UnsafeMutablePointer<Double>(OpaquePointer(out.dataPointer))
to:
let pointer = UnsafeMutablePointer<Float>(OpaquePointer(out.dataPointer))
hello @hollance Thank you for the replay, I've changed the pointer type Float instead of the Doublebut still crash at the below line.
for c in 0 ..< 52 {
classes[c] = Float(pointer[offset(ch: boxOffset + 5 + c, x: x, y: y)])
}
I've noticed one thing is that my working model has the shape and strides 5 elements and the current model has the 4 elements does that effect?
here is the screenshot https://prnt.sc/vhcu8e
Naturally, if your model arranges the data differently, you'll also have to change how the code reads that data. ;-)
Ok, thanks for understating but is there any way to change MLMultiArray datatype is double 171
instead of the Flot32
at the convert time .h5
to mlmodel
because I've coupe of old model which is currently working with the current YOLO output read architecture So I don't want to write multiple architectures.
Also, I've discussed with the ML developer, model data arrange the same as the old model so I thought something is wrong in my convert script but I'm not sure about that.
The 171 is because there are 3 boxes predicted per grid cell and there are 52 classes that you're predicting. So boxesPerCell has to be 3, did you change that accordingly?
Yes, boxes per cell has the 3 but in Flot32 output like Float32 1 × 13 × 13 × 171 array
and the Double type output Double 1 × 1 × 171 × 26 × 26 array
that is the difference I'm having a hard time to calculate bbx, bby, bbw, bbh.
Is this a YOLOv3 model, @Techgps1?
custom yolo-v3 tiny
YOLOv3 is slightly different from YOLOv2 in that you now have multiple output grids instead of just one. See here for the differences: https://github.com/Ma-Dan/YOLOv3-CoreML
I've fetched the issue while model output type MLMultiArray Flot32 multidimensional array of floats.
Heres in my convert script for .h5 to ml model using coremltools 4.0
Run the above script with python3 and here is my model generate with output MLMultiArray with datatype Flot32 multidimensional array of floats. https://prnt.sc/vg1dkl Here is my working model output MLMultiArray with datatype as 171 element vector of doubles. https://prnt.sc/vg1g7j
App crash while generating the bbx,bby,bbw,bbh I've created custom function for generating boxes here is the code.
If model output MLMultiArray datatype is double 171 above code working well but issue in Float 32.
Any assistance would be appreciated