BerkeleyAutomation / dex-net

Repository for reading the Dex-Net 2.0 HDF5 database of 3D objects, parallel-jaw grasps, and robust grasp metrics
https://berkeleyautomation.github.io/dex-net/code.html
Other
295 stars 97 forks source link

Dex-Net on Ubuntu 20.04 + Noetic test fails #64

Open Greg8978 opened 3 years ago

Greg8978 commented 3 years ago

Hi! I know it's not a tested version for ubuntu, but I'm still commited to make this work on Noetic / ubuntu 20.04

I ran into several issues that I could solve with various documentation / issues already posted. I finally succeeded, with some fix here and there, to compile without error. My issue is when I launch the test, I get the following result:

running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
creating src/dex_net.egg-info
writing src/dex_net.egg-info/PKG-INFO
writing dependency_links to src/dex_net.egg-info/dependency_links.txt
writing requirements to src/dex_net.egg-info/requires.txt
writing top-level names to src/dex_net.egg-info/top_level.txt
writing manifest file 'src/dex_net.egg-info/SOURCES.txt'
reading manifest file 'src/dex_net.egg-info/SOURCES.txt'
writing manifest file 'src/dex_net.egg-info/SOURCES.txt'
running build_ext
database_test (unittest.loader._FailedTest) ... ERROR
grasping_test (unittest.loader._FailedTest) ... ERROR
learning_test (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: database_test (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: database_test
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/user_adm/catkin_ws/src/dex-net/test/database_test.py", line 37, in <module>
    from perception import CameraIntrinsics, RenderMode
ImportError: cannot import name 'CameraIntrinsics' from 'perception' (/home/user_adm/catkin_ws/devel/lib/python3/dist-packages/perception/__init__.py)

======================================================================
ERROR: grasping_test (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: grasping_test
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/user_adm/catkin_ws/src/dex-net/test/grasping_test.py", line 36, in <module>
    from perception import CameraIntrinsics
ImportError: cannot import name 'CameraIntrinsics' from 'perception' (/home/user_adm/catkin_ws/devel/lib/python3/dist-packages/perception/__init__.py)

======================================================================
ERROR: learning_test (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: learning_test
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/user_adm/catkin_ws/src/dex-net/test/learning_test.py", line 38, in <module>
    from dexnet.learning import RandomBinaryObjective, RandomContinuousObjective, UniformAllocationMean, ThompsonSampling, GaussianUniformAllocationMean, MaxIterTerminationCondition
  File "/home/user_adm/catkin_ws/src/dex-net/src/dexnet/__init__.py", line 23, in <module>
    from abstractstatic import abstractstatic
ModuleNotFoundError: No module named 'abstractstatic'

----------------------------------------------------------------------
Ran 3 tests in 0.000s

FAILED (errors=3)
Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>

I installed perception and everything required following this document.

Any help would be greatly appreciated :)

Greg8978 commented 3 years ago

If anyone bump into the same issue, it comes from this [commit]( https://github.com/BerkeleyAutomation/perception/commit/1dd48f392bc3777b2111636180cdac31d620751d): it removes CameraInstrinsics!

Reverting perception repo fixed it for me. I had other issues though, mainly compatibility between tensorflow1 and python3.8. I ended up installing only gqcnn with python 3.7, which may be enough for me.

Jasonleeo-cpu commented 3 years ago

Could you help me to solve the problem as follows or tell me some details about it ? Unable to import meshrender shared library! Rendering will not work. Likely due to missing Boost.Numpy Boost.Numpy can be installed following the instructions in https://github.com/ndarray/Boost.NumPy Thanks in advance!!

Greg8978 commented 3 years ago

Hey! Depending on what version you are using, you should try this: https://github.com/BerkeleyAutomation/meshpy/issues/1

Here is what I did:

#include <boost/python.hpp>
#include "boost/python/extract.hpp"
//#include "boost/python/numeric.hpp"

#if BOOST_VERSION < 106500
#include <boost/python/numeric.hpp>
#else
#include <boost/python/numpy.hpp>
#endif

//#include <boost/numpy.hpp>

...

Then in the code, replace boost::python::numeric by boost::python::numpy


boost::python::tuple render_mesh(boost::python::list proj_matrices,
                                 unsigned int im_height,
                                 unsigned int im_width,
                                 boost::python::numpy::ndarray verts,
                                 boost::python::numpy::ndarray tris,
                                 boost::python::numpy::ndarray norms,
                                 boost::python::numpy::ndarray mat_props,
                                 boost::python::numpy::ndarray light_props,
                 bool enable_lighting = false,
                                 bool debug = false)

(...)

 // append ndarray color image to list
    boost::python::tuple color_shape = boost::python::make_tuple(im_height, im_width, 3);
    boost::python::numpy::dtype color_dt = boost::python::numpy::dtype::get_builtin<unsigned char>();
    boost::python::numpy::ndarray color_arr = boost::python::numpy::from_data(color_result, color_dt, color_shape,
                                                              boost::python::make_tuple(color_shape[1]*color_shape[2]*sizeof(unsigned char),
                                                                                        color_shape[2]*sizeof(unsigned char),
                                                                                        sizeof(unsigned char)),
                                                              boost::python::object());
    color_ims.append(color_arr.copy());
   // append ndarray depth image to list
    boost::python::tuple depth_shape = boost::python::make_tuple(im_height, im_width);
    boost::python::numpy::dtype depth_dt = boost::python::numpy::dtype::get_builtin<float>();
    boost::python::numpy::ndarray depth_arr = boost::python::numpy::from_data(depth_result, depth_dt, depth_shape,
                                                              boost::python::make_tuple(depth_shape[1]*sizeof(float),
                                                                                        sizeof(float)),
                                                              boost::python::object());
    depth_ims.append(depth_arr.copy());
  }

(...)


// Test function for multiplying an array by a scalar
boost::python::list mul_array(boost::python::numpy::ndarray data, int x)
{
  // Access a built-in type (an array)
  boost::python::numpy::ndarray a = data;
  long int bufLen;
  void const *buffer;

(...)

const boost::python::tuple& shape = boost::python::extract<boost::python::tuple>(a.attr("shape"));
  std::cout << "Shape " << boost::python::extract<int>(shape[0]) << " " << boost::python::extract<int>(shape[1]) << std::endl;
  boost::python::numpy::dtype dt = boost::python::numpy::dtype::get_builtin<double>();
  boost::python::numpy::ndarray result = boost::python::numpy::from_data(mult, dt, shape,
                                                         boost::python::make_tuple(shape[0]*sizeof(double),
                                                                                   sizeof(double)),
                                                         boost::python::object());

(...)


// Expose classes and methods to Python
BOOST_PYTHON_MODULE(meshrender) {
  Py_Initialize();
  boost::python::numpy::initialize();

  def("mul_array", &mul_array);
  def("render_mesh", &render_mesh);
}
Ultraopxt commented 2 years ago

Hi! I know it's not a tested version for ubuntu, but I'm still commited to make this work on Noetic / ubuntu 20.04

I ran into several issues that I could solve with various documentation / issues already posted. I finally succeeded, with some fix here and there, to compile without error. My issue is when I launch the test, I get the following result:

running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
creating src/dex_net.egg-info
writing src/dex_net.egg-info/PKG-INFO
writing dependency_links to src/dex_net.egg-info/dependency_links.txt
writing requirements to src/dex_net.egg-info/requires.txt
writing top-level names to src/dex_net.egg-info/top_level.txt
writing manifest file 'src/dex_net.egg-info/SOURCES.txt'
reading manifest file 'src/dex_net.egg-info/SOURCES.txt'
writing manifest file 'src/dex_net.egg-info/SOURCES.txt'
running build_ext
database_test (unittest.loader._FailedTest) ... ERROR
grasping_test (unittest.loader._FailedTest) ... ERROR
learning_test (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: database_test (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: database_test
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/user_adm/catkin_ws/src/dex-net/test/database_test.py", line 37, in <module>
    from perception import CameraIntrinsics, RenderMode
ImportError: cannot import name 'CameraIntrinsics' from 'perception' (/home/user_adm/catkin_ws/devel/lib/python3/dist-packages/perception/__init__.py)

======================================================================
ERROR: grasping_test (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: grasping_test
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/user_adm/catkin_ws/src/dex-net/test/grasping_test.py", line 36, in <module>
    from perception import CameraIntrinsics
ImportError: cannot import name 'CameraIntrinsics' from 'perception' (/home/user_adm/catkin_ws/devel/lib/python3/dist-packages/perception/__init__.py)

======================================================================
ERROR: learning_test (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: learning_test
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/user_adm/catkin_ws/src/dex-net/test/learning_test.py", line 38, in <module>
    from dexnet.learning import RandomBinaryObjective, RandomContinuousObjective, UniformAllocationMean, ThompsonSampling, GaussianUniformAllocationMean, MaxIterTerminationCondition
  File "/home/user_adm/catkin_ws/src/dex-net/src/dexnet/__init__.py", line 23, in <module>
    from abstractstatic import abstractstatic
ModuleNotFoundError: No module named 'abstractstatic'

----------------------------------------------------------------------
Ran 3 tests in 0.000s

FAILED (errors=3)
Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>

I installed perception and everything required following this document.

Any help would be greatly appreciated :)

Hi, Did you run dexnet on ubuntu20.04 succesfully?

GregoireMilliez commented 2 years ago

Hi!

We ran only with GQCNN, we gave up on Dex-Net. Even GQCNN was hard to use as the normalization of data is complex without Dex-Net tools.

However we found this document that may be of interest for you: https://www.imperial.ac.uk/media/imperial-college/faculty-of-engineering/computing/public/1819-ug-projects/SaporaS-Grasp-Quality-Deep-Neural-Networks-for-Robotic-Object-Grasping.pdf

Cheers

Ultraopxt commented 2 years ago

Hi!

We ran only with GQCNN, we gave up on Dex-Net. Even GQCNN was hard to use as the normalization of data is complex without Dex-Net tools.

However we found this document that may be of interest for you: https://www.imperial.ac.uk/media/imperial-college/faculty-of-engineering/computing/public/1819-ug-projects/SaporaS-Grasp-Quality-Deep-Neural-Networks-for-Robotic-Object-Grasping.pdf

Cheers

Thanks very much!

Could you please share the github link of this paper?

GregoireMilliez commented 2 years ago

https://github.com/SilviaSapora/dex-net-silvia

elevenjiang1 commented 2 years ago

I also have same problem! I think the main problem is the version are too mess in autolab github !

elevenjiang1 commented 2 years ago

It seems that in Python3,or in high version in autolab_core,from perception import CameraIntrinsics need to change to from autolab_core import CameraIntrinsics

I have setup dexnet on Ubuntu 16.04 python2, but give up setup python3 in Ubuntu18.04.Also, I have setup gqcnn on Ubuntu16.03 in python3. All the environment setup is in docker. If you need help, I can give you more detail~

weiyunpei commented 2 years ago

It seems that in Python3,or in high version in autolab_core,from perception import CameraIntrinsics need to change to from autolab_core import CameraIntrinsics

I have setup dexnet on Ubuntu 16.04 python2, but give up setup python3 in Ubuntu18.04.Also, I have setup gqcnn on Ubuntu16.03 in python3. All the environment setup is in docker. If you need help, I can give you more detail~

hello,could you please send a github link , I am doing my undergraduate project.THANKS!

elevenjiang1 commented 2 years ago

It seems that in Python3,or in high version in autolab_core,from perception import CameraIntrinsics need to change to from autolab_core import CameraIntrinsics I have setup dexnet on Ubuntu 16.04 python2, but give up setup python3 in Ubuntu18.04.Also, I have setup gqcnn on Ubuntu16.03 in python3. All the environment setup is in docker. If you need help, I can give you more detail~

hello,could you please send a github link , I am doing my undergraduate project.THANKS!

Sorry, I haven't cleaned my code now. If you need more help, maybe you can ask them by email: 1206413225@qq.com

Manu752 commented 2 months ago

Hi , Were you guys able to get dex-net /GPD eunning on ubuntu 20.4 with ros noetic ? ...I have a project underway and I cant seem to get past the build stage (step 4) of the repo :(

Greg8978 commented 2 months ago

Hi, on our side we actually gave up on DexNet, we moved to RGBMatter rgb_matters and suctionNet. It was easier to use. https://github.com/GouMinghao/rgb_matters

Manu752 commented 2 months ago

thank you for the prompt response :) ... does RGBMatter rgb_matters work with move it ? I went threw the repo but couldn't find any doc on how to integrate it with moveit .

Greg8978 commented 2 months ago

Yes, we deployed it on Niryo Ned 2, which is using MoveIt. GraspNet will give you the gripping pose. You will then need to feed it to MoveIt