Closed lumenghz closed 7 years ago
Yes, the full YOLO model contains a type of layer that is currently not supported by Core ML.
@hollance Thanks for your reply 😄
And I have another problem. Something I downloaded TinyYOLO
which have 80 classes and convert it to .mlmodel
.
I record a gif.
Here is what I changed:
let lebels = [
"person", "bicycle", "car", "motorbike", "aeroplane", "bus", "train", "truck", "boat",
"traffic light", "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat",
"dog", "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", "backpack",
"umbrella", "handbag", "tie", "suitcase", "frisbee", "skis", "snowboard", "sports ball",
"kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket",
"bottle", "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple",
"sandwich", "orange", "broccoli", "carrot", "hot dog", "pizza", "donut", "cake",
"chair", "sofa", "pottedplant", "bed", "diningtable", "toilet", "tvmonitor", "laptop",
"mouse", "remote", "keyboard", "cell phone", "microwave", "oven", "toaster", "sink",
"refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier",
"toothbrush"
]
let anchors: [Float] = [
0.738768 ,0.874946, 2.42204, 2.65704, 4.30971,
7.04493, 10.246, 4.59428, 12.6868, 11.8741
]
I set videoCapture.fps = 1
Did I made something wrong?
@hollance Do you have any ideas about it?
I haven't tried this version of the model myself. I first would check that the number of bounding boxes is correct (there seem to be quite a few of them), then what the coordinates of the boxes are. Maybe the anchors are wrong?
The number of bounding boxes is 10. (seems right?)
The .cfg
of tiny-yolo
and tiny-yolo-voc
seems similar. So I guess I don't need change other properties except labels
, anchors
and model
?
And the anchors was copied from the generated tiny-yolo_anchors.txt
. It should be right.
I've already ran test_yolo.py
and the result seems correct. But it all mess when I change the model in iOS.
Do you mind to test it for me if you have time? Thanks in advance
Hi @hollance
I did some test today. This is the step below:
computeBoundingBoxes
after filter by confidence threshold.
debugPrint("prediction count after filter by confidence ==> ", predictions.count)
computeBoundingBoxes
before return
so the end of method becomelet results = nonMaxSuppression(boxes: predictions, limit: YOLO.maxBoundingBoxes, threshold: iouThreshold)
debugPrint("result count after filter: ", results.count)
return results
Result:
When I ran your model (Tiny-YOLO-VOC) that have 20 classes, the two debugPrint always be 0
and that is the right result.
When I ran the model (Tiny_YOLO) that have 80 classes. The first debugPrint always > 70
and the second one always = 10
(limit box count)
The situation didn't become good even I change the confidenceThreshold
to 0.8
. So forget the anchors temporarily because this result is not expected.
The result seems good when I ran test_yolo.py
after generated .h5
. So I'm very doubt about the result I saw in iOS.
Do you have any ideas?
Hi @hollance
I think I found the reason after read all code. And that's my fault because I didn't read the code carefully before ask.
In method computeBoundingBoxes
there is a const named numClasses
, I need to change it to 80
. And the colors
should be changed also.
I'm sorry for disturbing you. Thanks to provided such a good example. 😄
Great, I'm happy it works now. :smile:
@hollance @lubeast I was trying to convert full yolo using yad2k too and have faced the same problem. The real issue is in the converted Keras model from Darknet and not that coreml don't support all of the layers.
@lubeast Have you made any progress in this area?
Simple script can prove that
from keras.models import load_model
model = load_model('yad2k/model_data/yolo-voc.h5')
Hi
I meet a problem when I convert yolo.weight (not tinyyolo) and hope you can help me.
Environment Python 3.5.2 + Python 2.7.13
pip2 list
pip3 list
Step 1 Convert yolo.weights to yolo.h5 success. And I've tested the .h5 can work normally.
Step 2 Convert yolo.h5 to coreml command: python2 coreml_yolo.py output:
I also tried Keras version 1.2.2, same problem.