wg-perception / linemod

An OR pipeline based on LINE-MOD from OpenCV
47 stars 55 forks source link

Adding second model -> training -> error: freeglut illegal glutInit() reinitialization attempt #20

Open YantianZha opened 8 years ago

YantianZha commented 8 years ago

rosrun object_recognition_core training -c rospack find object_recognition_linemod/conf/training.ork Training 2 objects. computing object_id: 26fd4a3e0309ca93c5d8ba054b001268 Info, T0: Load /tmp/filejUzsrU.obj Info, T0: Found a matching importer for this file format Info, T0: Import root directory is '/tmp/' Error, T0: OBJ: Unable to locate material file paper_cup.mtl Error, T0: OBJ: failed to locate material None.001, skipping Info, T0: Entering post processing pipeline Info, T0: Points: 0, Lines: 0, Triangles: 1, Polygons: 0 (Meshes, X = removed) Error, T0: Failed to compute tangents; need UV data in channel0 Info, T0: JoinVerticesProcess finished | Verts in: 71400 out: 48417 | ~32.2% Info, T0: Cache relevant are 1 meshes (23800 faces). Average output ACMR is 2.034622 Info, T0: Leaving post processing pipeline Deleting the previous model 26fd4a3e0309ca93c5d8ba054b0027bb of object 26fd4a3e0309ca93c5d8ba054b001268 computing object_id: bd469776b362b00f0f60e3e3bd000425 freeglut illegal glutInit() reinitialization attempt

The first possible reason is: my model is wrong. For your convenience here is the link to my model: https://drive.google.com/folderview?id=0BwZMlUaV88n6OWNqbUtGUE84Y1U&usp=sharing

That said, I created the model with blender following the tutorial (http://wg-perception.github.io/ork_tutorials/tutorial01/tutorial.html#creating-an-object-in-the-db). There're two points: origin, and size. I think my model in right by following the coke.obj (NOT coke.stl) model as an sample.

Another possible reason is: https://github.com/wg-perception/linemod/issues/3 That link refers to https://github.com/wg-perception/ork_renderer/commit/bf49f057ecadbd3737c2d5d7e4fc183616fa65ec But I can't find the fie "src/renderer_glut.cpp". The closest file I can find is: "ork_renderer/src/renderer3d_impl_glut.cpp". But I suspect I don't need to change that file any more?

Thanks very much!

mayurand commented 8 years ago

I am also having the same issue. It would great if anyone can help.

Thanks

RudiRobot commented 8 years ago
  1. (Error, T0: Failed to compute tangents; need UV data in channel0) You have to create an UV map of your object in blender. Don't ask me what is the best uv map for line mod recognition. But you can be guided by the tutorial can. I am looking forward to get hints.
  2. (Error, T0: OBJ: Unable to locate material file paper_cup.mtl) a) If you export your obj, you can exclude the material file b) You have to add the material file to the right folder (In my case it was the /tmp folder).
YantianZha commented 8 years ago

Thanks, @RudiRobot .

I moved my files to /tmp folder, and then train, detect. This time I created my first model with paper_cup, and it worked (with training). It worked perfectly. My paper cup was detected successfully!

And then I created my second model with the official coke, then I got the same error: freeglut illegal glutInit() reinitialization attempt

The problem is, I can't train the second model.

Note: the error comes from using cmd: rosrun object_recognition_core training -c rospack find object_recognition_linemod/conf/training.ork

Output: Training 2 objects. computing object_id: a84197cfa8cb5e6024cb6bed5a0006bd Info, T0: Load /tmp/filecOqRT9.obj Info, T0: Found a matching importer for this file format Info, T0: Import root directory is '/tmp/' Info, T0: Entering post processing pipeline Info, T0: Points: 0, Lines: 0, Triangles: 1, Polygons: 0 (Meshes, X = removed) Error, T0: Failed to compute tangents; need UV data in channel0 Info, T0: JoinVerticesProcess finished | Verts in: 71400 out: 48417 | ~32.2% Info, T0: Cache relevant are 1 meshes (23800 faces). Average output ACMR is 2.034622 Info, T0: Leaving post processing pipeline Deleting the previous model a84197cfa8cb5e6024cb6bed5a0022a4 of object a84197cfa8cb5e6024cb6bed5a0006bd computing object_id: a84197cfa8cb5e6024cb6bed5a001b12 freeglut illegal glutInit() reinitialization attempt

After deleting the second object in db, and train again, no error. Everything works fine.

I think this is a bug. ORK people solved one bug by changing ork_renderer to use glut to train models and detect objects. This then gets this second bug.

Thanks!

YantianZha commented 8 years ago

A possible solution is to change object_id parameter in ork_linemod/apps/training

    print('Training %d objects.' % len(object_ids))
    #for object_id in object_ids:
object_id = "a84197cfa8cb5e6024cb6bed5a0006bd"
    print('computing object_id: %s' % object_id)
    object_id = object_id.encode('ascii')

Then training worked fine.

Then when trying to detect the object, you would still get the error: freeglut illegal glutInit() reinitialization attempt

And this time you CANNOT detect each object separately, like training. And if you don't use GLUT, you would met another kind of error: https://github.com/wg-perception/linemod/issues/18

nlyubova commented 8 years ago

Training works for several objects when using STL meshes. Did you try it?

YantianZha commented 8 years ago

Yes. But it did not work. "freeglut illegal glutInit() reinitialization attempt" still exists.

YantianZha commented 8 years ago

I suddenly got this: rosrun object_recognition_core training -c rospack find object_recognition_linemod/conf/training.ork [FATAL] [1452744215.058069762]: You must call ros::init() before creating the first NodeHandle Couldn't find an AF_INET address for [] Couldn't find an AF_INET address for [] [ERROR] [1452744215.059014505]: [registerPublisher] Failed to contact master at [:0]. Retrying... Couldn't find an AF_INET address for [] Couldn't find an AF_INET address for [] ...

I didn't change anything. I just ran the training node. I don't know whether someone met this before.

YantianZha commented 8 years ago

Hi @nlyubova , Could you let me know how you installed the GLUT? I'm using ubuntu 14.04.3, is it same with you? I'm using freeglut, but I can't find anywhere in ORK workspace includes freeglut.h Thanks!

JimmyDaSilva commented 8 years ago

@YantianZha, I got the AF_INET error as well.

For me I think the problem was adding the arg -DLINEMOD_VIZ_PCD=ON when compiling. It actually compiles fine and the real_icpin_ref and real_icpin_model are published when running the detection, but the training then does not work any more

@YantianZha : just run catkin_make -DLINEMOD_VIZ_PCD=OFF

nlyubova commented 8 years ago

right @JimmyDaSilva , it is because of nodeHandle when -DLINEMOD_VIZ_PCD=ON, we should fix it

JimmyDaSilva commented 8 years ago

@nlyubova I still don't understand where it comes from .Since LINEMOD_VIZ_PCD is only in linemod_detect.cpp how can this param impact the build of linemod_training.cpp ?

nlyubova commented 8 years ago

@JimmyDaSilva , right, it is in linemod_detect.cpp but they are compiled together

nlyubova commented 8 years ago

fixed it in https://github.com/nlyubova/linemod/commit/06f48f9f7ec08903731d5f4ac9599238ad753929

JimmyDaSilva commented 8 years ago

@nlyubova That solves it ! Tested and approved. Can you push this ?

nlyubova commented 8 years ago

Yeah, also tested and already done a pull request On Feb 22, 2016 18:36, "Jimmy DA SILVA" notifications@github.com wrote:

@nlyubova https://github.com/nlyubova That solves it ! Tested and approved. Can you push this ?

— Reply to this email directly or view it on GitHub https://github.com/wg-perception/linemod/issues/20#issuecomment-187282930 .

JimmyDaSilva commented 8 years ago

@vrabaud Got fixed with https://github.com/wg-perception/ork_renderer/pull/12