Open filipetrocadoferreira opened 7 years ago
When doing batch processing and using yolo_eval, the output of bounding boxes has the shape of [?,4] instead of [batch,?,4]
Also having this issue, any updates on why this is the case?
Hi guys, I ran into the same issue! Has anybody been able to run it on batches?
I implemented a workaround that appears to do the job.
https://github.com/giulio-zhou/YAD2K/blob/master/yad2k/models/keras_yolo.py#L351-L400
I believe the issue is that when the original implementation applies a K.argmax
to extract the highest scoring boxes, it's doing it over the entire tensor that gets produced in the batch inference (aka all of the input images at once). The result is then flattened (with non-maximal suppression applied) into boxes, scores, classes tensors that you see. My workaround explicitly defines the batch size - which you can't change - and creates TF graph nodes that extract the bounding boxes for each batch example separately. The results are concatenated, but then I use my frames tensor as an index into the other tensors. Hope this helps!
@giulio-zhou I think you're right. I was planning doing something similar but never got the time. I will try to test your implementation. Did you checked performance gains?
The way that I used it was part of another pipeline that post-processed the bounding boxes right after running the network which is now the bottleneck. I need to separate those two out if I want to measure performance, which I have yet to do.
@giulio-zhou That workaround works, but getting slower predictions!! I didnt do any processing after getting the predictions (~ 2 seconds slower for 50 images)
How can I setup the number of images to process in batch?