Giter Club home page Giter Club logo

Comments (5)

hmchung avatar hmchung commented on July 21, 2024

Latest update: I think the issue is pretty strange now...
What I did is adding a debug message into that loop, simple as this:
cout << "[Debugging] nid: " << nid << " - pid: " << pid << " - weights: " << weight << endl;
So the for loop now look like this

  for(unsigned int i = 0; i < fn.size(); ++i)
  {
    NodeId nid = (int)fn[i]["nodeId"];
    NodeId pid = (int)fn[i]["parentId"];
    WordValue weight = (WordValue)fn[i]["weight"];
    std::string d = (std::string)fn[i]["descriptor"];

    m_nodes[nid].id = nid;
    m_nodes[nid].parent = pid;
    m_nodes[nid].weight = weight;
    m_nodes[pid].children.push_back(nid);
    
    DescManip::fromString(m_nodes[nid].descriptor, d);

    std::cout << "[Debugging] nid: " << nid << " - pid: " << pid  << " - weights: " << weight << std::endl;
  }

Then it runs, but not consisitently. 50% of the times, it would give this error message:

OpenCV Error: Assertion failed (s >= 0) in setSize, file /home/chung/ws/opencv_ws/opencv/modules/core/src/matrix.cpp, line 310
/home/chung/ws/opencv_ws/opencv/modules/core/src/matrix.cpp:310: error: (-215) s >= 0 in function setSize

Even when it runs, it would stuck again at the subsequent testDatabase() function...
I am really confused now. Is it a compiler bug?

from dbow3.

junzhang2016 avatar junzhang2016 commented on July 21, 2024

I came across the same problem, and this link solved it: #6

from dbow3.

carlin314 avatar carlin314 commented on July 21, 2024

Hi, I came across this issue - "stuck" too in an embed platform, is this just the computation power too slow, or this is due to some inefficiency of program? I test in x86, it is ok, and can process 1w/s of my database, my database is 11w, so 11s will be ok, but in embed one, it is 0.7w/min, and it is to say it won't finish until 15min later, I didn't wait, but I am really confused, is this really need so much compute power? How you solve this, @hmchung I see in your github fork, I see just "if (i==0) usleep(1000)", and emmm, this doesn't really make ....that much sense, and I test it, nothing changed but wait 1s, so what's really going on with this issue, can I conclude it is just due to computation power not enough?

from dbow3.

carlin314 avatar carlin314 commented on July 21, 2024

It seems turn out to be the string stream is very slow on some platform without speed up: https://stackoverflow.com/questions/5830868/c-stringstream-is-too-slow-how-to-speed-up

and in essence, the database is not binary and that function is manual reverse serialization, which is not optimized.

If someone come across the same problem, the database can change to something like protobuf defined binary format.

from dbow3.

carlin314 avatar carlin314 commented on July 21, 2024

Forget what I said, in my case, it is due to OpenCV 4.0 reimplement of cv::FileNode data access

Persistence (storing and loading structured data to/from XML, YAML or JSON) in the core module has been completely reimplemented in C++ and lost the C API as well. For now base64 support is not complete (only loading base64-encoded XML and YAML is supported, encoding is not supported at all). Also, the random access of sequences stored in a FileNode is now a slow O(N) operation vs. fast O(1) in the previous implementation; use cv::FileNodeIterator for much faster sequential access. On the positive side, the loaded FileStorage's take 3-6x less memory than in the previous implementation.

refer to: https://github.com/opencv/opencv/wiki/ChangeLog#version400

Change the source code, use cv:;FIleNodeIterator will be ok.

from dbow3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.