Prerequisites
cd third_party/cython/
python setup.py install --user
cd ../..
问题:ModuleNotFoundError: No module named 'Cython'
解决:pip3 install --upgrade cython
Demo
python run_demo.py --data_dir=./demo/inputs --data_suffix=jpg --output=./demo
问题1:No module named 'skimage'
解决:pip3 install scikit-image
问题2:No module named 'cv2'
解决:pip3 install opencv-contrib-python
问题3:ModuleNotFoundError: No module named 'matplotlib'
解决:pip3 install matplotlib
问题4:ImportError: cannot import name 'imread' from 'scipy.ndimage'from imageio import imread
#使用imageio库同样能够完成此功能
问题5:ModuleNotFoundError: No module named 'scipy'
解决: pip3 install scipy
问题6:ImportError: cannot import name 'imsave' from 'scipy.misc'
解决:import imageio
img=imageio.imread(‘xx.png’)
问题:AttributeError: module 'numpy' has no attribute 'typeDict'
解决:pip install numpy==1.21
问题:ImportError: numpy.core.multiarray failed to import
解决:版本问题
!!!主要问题: scikit-image与scipy与numpy与python_version之间有约束
版本:scikit-image==0.20.0与scipy==1.8.0与numpy==1.22.1与py版本小于等于3.9
经常出问题的一些库的版本:
Package Version
----------------------------- ----------
actionlib 1.14.0
angles 1.9.13
bondpy 1.8.6
camera-calibration 1.17.0
camera-calibration-parsers 1.12.0
catkin 0.8.10
certifi 2022.12.7
charset-normalizer 3.1.0
cmake 3.26.1
Connectivity 0.0.0
contourpy 1.0.7
controller-manager 0.19.6
controller-manager-msgs 0.19.6
cPython 0.0.6
cv-bridge 1.16.2
cycler 0.11.0
Cython 0.29.33
diagnostic-analysis 1.11.0
diagnostic-common-diagnostics 1.11.0
diagnostic-updater 1.11.0
dnspython 2.3.0
dynamic-reconfigure 1.7.3
filelock 3.10.7
fonttools 4.39.2
gazebo_plugins 2.9.2
gazebo_ros 2.9.2
gencpp 0.7.0
geneus 3.0.0
genlisp 0.4.18
genmsg 0.6.0
gennodejs 2.0.2
genpy 0.6.15
idna 3.4
image-geometry 1.16.2
imageio 2.27.0
importlib-resources 5.12.0
interactive-markers 1.12.0
Jinja2 3.1.2
joint-state-publisher 1.15.1
joint-state-publisher-gui 1.15.1
kiwisolver 1.4.4
laser_geometry 1.6.7
lazy_loader 0.2
lit 16.0.0
MarkupSafe 2.1.2
matplotlib 3.7.1
message-filters 1.16.0
mpmath 1.3.0
networkx 3.0
numpy 1.22.1
nvidia-cublas-cu11 11.10.3.66
nvidia-cuda-cupti-cu11 11.7.101
nvidia-cuda-nvrtc-cu11 11.7.99
nvidia-cuda-runtime-cu11 11.7.99
nvidia-cudnn-cu11 8.5.0.96
nvidia-cufft-cu11 10.9.0.58
nvidia-curand-cu11 10.2.10.91
nvidia-cusolver-cu11 11.4.0.1
nvidia-cusparse-cu11 11.7.4.91
nvidia-nccl-cu11 2.14.3
nvidia-nvtx-cu11 11.7.91
opencv-contrib-python 4.7.0.72
packaging 23.0
Pillow 9.4.0
pip 23.0.1
pymongo 4.3.3
pyparsing 3.0.9
python-dateutil 2.8.2
python-qt-binding 0.4.4
PyWavelets 1.4.1
qt-dotgraph 0.4.2
qt-gui 0.4.2
qt-gui-cpp 0.4.2
qt-gui-py-common 0.4.2
requests 2.28.2
resource_retriever 1.12.7
rosbag 1.16.0
rosboost-cfg 1.15.8
rosclean 1.15.8
roscreate 1.15.8
rosgraph 1.16.0
roslaunch 1.16.0
roslib 1.15.8
roslint 0.12.0
roslz4 1.16.0
rosmake 1.15.8
rosmaster 1.16.0
rosmsg 1.16.0
rosnode 1.16.0
rosparam 1.16.0
rospy 1.16.0
rosservice 1.16.0
rostest 1.16.0
rostopic 1.16.0
rosunit 1.15.8
roswtf 1.16.0
rqt_action 0.4.9
rqt_bag 0.5.1
rqt_bag_plugins 0.5.1
rqt_console 0.4.11
rqt_dep 0.4.12
rqt_graph 0.4.14
rqt_gui 0.5.3
rqt_gui_py 0.5.3
rqt_image_view 0.4.16
rqt_launch 0.4.9
rqt_logger_level 0.4.11
rqt-moveit 0.5.10
rqt_msg 0.4.10
rqt_nav_view 0.5.7
rqt_plot 0.4.13
rqt_pose_view 0.5.11
rqt_publisher 0.4.10
rqt_py_common 0.5.3
rqt_py_console 0.4.10
rqt-reconfigure 0.5.5
rqt-robot-dashboard 0.5.8
rqt-robot-monitor 0.5.14
rqt_robot_steering 0.5.12
rqt_runtime_monitor 0.5.9
rqt-rviz 0.7.0
rqt_service_caller 0.4.10
rqt_shell 0.4.11
rqt_srv 0.4.9
rqt_tf_tree 0.6.3
rqt_top 0.4.10
rqt_topic 0.4.13
rqt_web 0.4.10
rviz 1.14.19
scikit-image 0.20.0
scipy 1.8.0
sensor-msgs 1.13.1
setuptools 65.6.3
six 1.16.0
smach 2.5.1
smach-ros 2.5.1
smclib 1.8.6
sympy 1.11.1
tf 1.13.2
tf-conversions 1.13.2
tf2-geometry-msgs 0.7.6
tf2-kdl 0.7.6
tf2-py 0.7.6
tf2-ros 0.7.6
tifffile 2023.3.21
topic-tools 1.16.0
torch 2.0.0
torchaudio 2.0.1
torchvision 0.15.1
triton 2.0.0
typing_extensions 4.5.0
urllib3 1.26.15
wheel 0.38.4
xacro 1.14.14
zipp 3.15.0
#june:from scipy.ndimage import imread
from imageio import imread
#june:from scipy.misc import imsave
import imageio
把imread的部分换成imageio.imread
Data preparation
问题:ModuleNotFoundError: No module named 'joblib'
解决:pip3 install joblib
cd data_preprocessing
python pre_process_bsd500.py --dataset=<BSDS_DIR> --dump_root=<DUMP_DIR>
python pre_process_bsd500_ori_sz.py --dataset=<BSDS_DIR> --dump_root=<DUMP_DIR>
cd ..
Training
问题:ModuleNotFoundError: No module named 'tensorboardX'
解决:pip3 install tensorboardX
ps.pip3 install tensorboard
pip3 install tensorflow
问题:
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 36.00 MiB (GPU 0; 1.83 GiB total capacity; 881.91 MiB already allocated; 12.00 MiB free; 944.00 MiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
torch.cuda.OutOfMemoryError: CUDA没有内存了。尝试分配36.00 MiB(GPU 0;总容量1.83 GiB;已分配881.91 MiB;空闲12.00 MiB;PyTorch共保留944.00 MiB)如果保留的内存>>分配的内存,尝试设置max_split_size_mb以避免碎片化。 请参阅内存管理和PYTORCH_CUDA_ALLOC_CONF的文档。
解决:一文解决 RuntimeError: CUDA out of memory. 全网最全_辞与不羡的博客-CSDN博客
Evaluation
问题:步骤根据链接出错。Ubuntu20.04安装glog和gflags
解决:Ubuntu20.04安装glog和gflags_ubuntu glog_Logtyu的博客-CSDN博客
问题:cmake .. -DGLOG_ROOT_DIR=~/glog出错
Cannot find source file:
../lib_refh/lib/graph_segmentation.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
CMake Error at reseeds_cli/CMakeLists.txt:37 (add_library):
Cannot find source file:
../lib_reseeds/lib/SeedsRevised.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
CMake Error at refh_cli/CMakeLists.txt:38 (add_library):
No SOURCES given to target: refh
CMake Error at reseeds_cli/CMakeLists.txt:37 (add_library):
No SOURCES given to target: reseeds
CMake Generate step failed. Build files cannot be regenerated correctly.
解决:修改cmakelist,把出问题的都OFF
问题:make出错
解决:修改文件
1问题:/home/june/superpixel-benchmark/lib_eval/evaluation.cpp:524:47: error: ‘CV_DIST_L2’ was not declared in this scope
解决:??
2问题:/home/june/superpixel-benchmark/lib_eval/evaluation.cpp:722:41: error: ‘CV_BGR2GRAY’ was not declared in this scope
解决:#include<opencv2/imgproc/types_c.h>
3问题:/home/june/superpixel-benchmark/lib_etps/spixel.cpp:78:38: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
解决:#include "opencv2/imgcodecs/legacy/constants_c.h"
4问题:/home/june/superpixel-benchmark/lib_etps/spixel.cpp:125:46: error: ‘CV_LOAD_IMAGE_ANYDEPTH’ was not declared in this scope
解决:CV_LOAD_IMAGE_ANYDEPTH 改为 cv::IMREAD_ANYDEPTH
5问题:/home/june/superpixel-benchmark/lib_eval/evaluation_summary.cpp:1191:55: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
解决:#include "opencv2/imgcodecs/legacy/constants_c.h"
6问题:/home/june/superpixel-benchmark/lib_eval/transformation.cpp:81:37: error: ‘CV_BGR2GRAY’ was not declared in this scope
解决:#include<opencv2/imgproc/types_c.h>
7问题:/home/june/superpixel-benchmark/lib_eval/robustness_tool.cpp:515:36: error: ‘CV_BGR2Lab’ was not declared in this scope
解决:CV_BGR2Lab 改成 cv::COLOR_BGR2Lab即可。
8问题:‘CV_Lab2BGR’ was not declared in this scope
解决:CV_Lab2BGR 改成 cv::COLOR_Lab2BGR
9问题:‘CV_BGR2YCrCb’ was not declared in this scope
解决:cv::COLOR_BGR2YCrCb
ps.以上错误,经过网上方法如果还是错的的话,官方会给出正确写法
1.将CV_BGR2YCrCb未声明标识符改为COLOR_BGR2YCrCb
2:在首行添加 #include<opencv2\core\core_c.h>
3: 在首行添加#include<opencv2\imgproc\types_c.h>
有人这么说,但我的没成功。官方提示我改成cv::COLOR_BGR2YCrCb
总结:
1.‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
#include "opencv2/imgcodecs/legacy/constants_c.h"
2.‘CV_FILLED’ was not declared in this scope
#include <opencv2/imgproc/imgproc_c.h>
3.‘CV_AA’ was not declared in this scope
#include "opencv2/imgproc/imgproc_c.h"
4.‘CV_RGB2GRAY’ was not declared in this scope
#include<opencv2/imgproc/types_c.h>
或
#include <opencv2/highgui/highgui_c.h>
5.‘CV_MINMAX’ was not declared in this scope
#include<opencv2/opencv.hpp>
7.‘CV_GRAY2RGB’ was not declared in this scope
#include<opencv2/imgproc/types_c.h>
8.CV_ADAPTIVE_THRESH_MEAN_C’ was not declared in this scope
#include <opencv2/calib3d/calib3d_c.h>
9.‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
#include"opencv2/imgcodecs/legacy/constants_c.h"
或
CV_LOAD_IMAGE_UNCHANGED 改为 cv::IMREAD_UNCHANGED
CV_LOAD_IMAGE_GRAYSCALE 改为 cv::IMREAD_GRAYSCALE
CV_LOAD_IMAGE_COLOR 改为 cv::IMREAD_COLOR
CV_LOAD_IMAGE_ANYDEPTH 改为 cv::IMREAD_ANYDEPTH
删除conda环境: