Open taontech opened 5 years ago
Could you tell me the behavior in detail?
If load binary vocabulary is slow, the cause maybe DBoW2's loadFromBinaryFile method in TemplatedVocabulary.h.
You may notice one line:
m_nodes.at(n_id).descriptor = cv::Mat(1, F::L, CV_8U);
which lies in a while loop. Usually the quantity of words is large. Meanwhile the cv::Mat constructor may trigger reallocate which sometimes can be slow.
The solution is create a sufficiently large cv::Mat outside the loop, and assign one row to m_nodes's descriptor each time accordingly, i.e.
m_nodes.at(n_id).descriptor = yourMat.row(row_index)
I have the same problem,especially with iOS 13
@taontech @riematrix @Dylanooo Thanks for reporting. We'll fix DBoW2 according to the solution provided by @riematrix.
I have a PR that fixed this issue for me in case anyone is interested
loadFromBinaryFile method cast very long time, I don't know where is the problem .