问题记录

1.img[:, :, [2, 1, 0]]

虽然我知道这是把opencv读取图片格式bgr转成rgb格式,但是这是什么语法啊,找了好久都没有找到

  img = cv2.imread(img_path)
  img = img[:, :, [2, 1, 0]]

很久之后看到这个:
a[:-1]也就是从0到最后一个(不包括最后一个)以1为步长的索引
a[::,-1]前面两个冒号,表示整个数组索引,-1代表转置(一维数组层面)
a[:,::-1]相比上面就在二维数组层面上了。
a[:,:,::-1]三维的层面上,因此可以通过此函数实现r、b通道的互换。

import numpy as np
>>>  
... a = np.array([[1,2,3],[3,4,5],[4,5,6]])  
>>> print (a[...,1])   # 第2列元素
[2 4 5]
>>> print (a[1,...])   # 第2行元素
[3 4 5]
>>> print (a[...,1:])  # 第2列及剩下的所有元素
[[2 3]
 [4 5]
 [5 6]]

2.pycharm 打开一个大工程目录会一直转圈显示 index,他是要把目录下面所有的都加载进来,

百度之后显示可以添加忽略目录
我的pycharm之前进去有时就一直indexing,最早的时候因为时间也不长,一直没有理会,后来越来越频繁,时间越来越长,我忍无可忍,就想着把这个问题解决一下,上网搜了好多种解决方案,有说什么 File-->Settings-->Project-->project Structure 把项目文件设置成Exclude。还有说File-->Invalidate Caches/restart。我试了全部没有作用,后来我发现是因为它index的时候总是在索引一些无用的文件,而且这些无用的文件通常非常大。我的解决方案如下
File-->Settings-->Editor-->FileTypes-->Ignore files ang floders。把你的那些大文件加入到这个里面之后便可以很快完成。

$py.class;.hprof;.pyc;.pyo;.rbc;.yarb;~;.DS_Store;.git;.hg;.svn;CVS;pycache;_svn;vssver.scc;vssver2.scc; data;.jpg;.png;.tar;

3.numpy 转opencv图像显示

 img11 = (kernals[0] * 255).astype(np.uint8)
 cv2.imshow("img11",img11)
 cv2.waitKey(0)

4. 把-5.79453e-12用c语言写出来

一开始写的,看到e,就查e的n次方,然后就看到,应该这么写-5.79453*exp(-12)
然后代码怎么调试都不对!!!!
错了啊,终端里面显示出来的-5.79453e-12,表示的是10的-12次方啊!!!!!
应该用pow(10,-12)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

5. cmakelist 编译caffe报错

[ 90%] Built target finetune_net
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadRGBAStrip@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadDirectory@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFWriteEncodedStrip@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFIsTiled@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFWriteScanline@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFGetField@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFNumberOfStrips@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFScanlineSize@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadEncodedTile@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadRGBATile@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFClose@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFRGBAImageOK@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFOpen@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadEncodedStrip@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFSetField@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFSetWarningHandler@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFSetErrorHandler@LIBTIFF_4.0’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:140: recipe for target 'tools/upgrade_solver_proto_text' failed
make[2]: *** [tools/upgrade_solver_proto_text] Error 1
CMakeFiles/Makefile2:479: recipe for target 'tools/CMakeFiles/upgrade_solver_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_solver_proto_text.dir/all] Error 2
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadRGBAStrip@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadDirectory@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFWriteEncodedStrip@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFIsTiled@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFWriteScanline@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFGetField@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFNumberOfStrips@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFScanlineSize@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadEncodedTile@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadRGBATile@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFClose@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFRGBAImageOK@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFOpen@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadEncodedStrip@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFSetField@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFSetWarningHandler@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFSetErrorHandler@LIBTIFF_4.0’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_net_proto_text.dir/build.make:140: recipe for target 'tools/upgrade_net_proto_text' failed
make[2]: *** [tools/upgrade_net_proto_text] Error 1
CMakeFiles/Makefile2:631: recipe for target 'tools/CMakeFiles/upgrade_net_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_net_proto_text.dir/all] Error 2
[ 90%] Linking CXX executable extract_features
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadRGBAStrip@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadDirectory@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFWriteEncodedStrip@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFIsTiled@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFWriteScanline@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFGetField@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFNumberOfStrips@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFScanlineSize@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadEncodedTile@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadRGBATile@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFClose@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFRGBAImageOK@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFOpen@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFReadEncodedStrip@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFSetField@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFSetWarningHandler@LIBTIFF_4.0’未定义的引用
/home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0:对‘TIFFSetErrorHandler@LIBTIFF_4.0’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/extract_features.dir/build.make:140: recipe for target 'tools/extract_features' failed
make[2]: *** [tools/extract_features] Error 1
CMakeFiles/Makefile2:593: recipe for target 'tools/CMakeFiles/extract_features.dir/all' failed
make[1]: *** [tools/CMakeFiles/extract_features.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

请来jiaming,一顿操作:

locate tiff.so

 cd /usr/lib/x86_64-linux-gnu/
 grep -r TIFFIsTiled@LIBTIFF_4.0
ll |grep tiff

 strings  libtiff.so|grep TIFFIsTiled

ldd /home/yhl/software_install/opencv3.2/lib/libopencv_imgcodecs.so.3.2.0 |grep tiff

解决方案:在cmake -> Dependencies.cmake ->

# ---[ OpenCV
if(USE_OPENCV)
  find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs videoio)
  if(NOT OpenCV_FOUND) # if not OpenCV 3.x, then imgcodecs are not found
    find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc)
  endif()
  include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
   list(APPEND Caffe_LINKER_LIBS ${OpenCV_LIBS} libtiff.so)    #list(APPEND Caffe_LINKER_LIBS ${OpenCV_LIBS})
  message(STATUS "OpenCV found (${OpenCV_CONFIG_PATH})")
  add_definitions(-DUSE_OPENCV)
endif()

就解决了,只加了 libtiff.so就解决了!!!
问他,他说相当于加-l
牛逼!

6. 报错解决

SET(D2C_LIB pthread /usr/lib/x86_64-linux-gnu/libtiff.so.5 uvc d2c  UvcSwapper OpenNI2  opencv_calib3d opencv_core opencv_highgui opencv_imgproc)

link_directories("/usr/lib/x86_64-linux-gnu")
link_directories(/data_1/Yang/software_install/Anaconda1105/lib)
export  看环境变量
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH 临时添加环境变量

重现问题:

[ 88%] Linking CXX executable ../../bin/StreamShow
/usr/bin/ld: warning: libjpeg.so.9, needed by //usr/local/lib/libuvc.so, not found (try using -rpath or -rpath-link)
//usr/local/lib/libuvc.so:对‘jpeg_finish_decompress@LIBJPEG_9.0’未定义的引用
//usr/local/lib/libuvc.so:对‘jpeg_destroy_decompress@LIBJPEG_9.0’未定义的引用
//usr/local/lib/libuvc.so:对‘jpeg_CreateDecompress@LIBJPEG_9.0’未定义的引用
//usr/local/lib/libuvc.so:对‘jpeg_alloc_huff_table@LIBJPEG_9.0’未定义的引用
//usr/local/lib/libuvc.so:对‘jpeg_std_error@LIBJPEG_9.0’未定义的引用
//usr/local/lib/libuvc.so:对‘jpeg_start_decompress@LIBJPEG_9.0’未定义的引用
//usr/local/lib/libuvc.so:对‘jpeg_read_header@LIBJPEG_9.0’未定义的引用
//usr/local/lib/libuvc.so:对‘jpeg_read_scanlines@LIBJPEG_9.0’未定义的引用
//usr/local/lib/libuvc.so:对‘jpeg_mem_src@LIBJPEG_9.0’未定义的引用
collect2: error: ld returned 1 exit status
StreamViewer/CMakeFiles/StreamShow.dir/build.make:199: recipe for target '../bin/StreamShow' failed
make[2]: *** [../bin/StreamShow] Error 1
CMakeFiles/Makefile2:142: recipe for target 'StreamViewer/CMakeFiles/StreamShow.dir/all' failed
make[1]: *** [StreamViewer/CMakeFiles/StreamShow.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

/usr/bin/ld: warning: libjpeg.so.9, needed by //usr/local/lib/libuvc.so, not found (try using -rpath or -rpath-link)
这句话,
locate libjpeg.so.9
会出来

/data_1/Yang/software_install/Anaconda1105/envs/pytorch_study/lib/libjpeg.so.9.2.0
/data_1/Yang/software_install/Anaconda1105/lib/libjpeg.so.9
/data_1/Yang/software_install/Anaconda1105/lib/libjpeg.so.9.2.0
/data_1/Yang/software_install/Anaconda1105/pkgs/jpeg-9b-h024ee3a_2/lib/libjpeg.so.9
/data_1/Yang/software_install/Anaconda1105/pkgs/jpeg-9b-h024ee3a_2/lib/libjpeg.so.9.2.0

然后在cmakelist加上这句话:

link_directories(/data_1/Yang/software_install/Anaconda1105/lib/)

然后又报另外的错误:

[ 88%] Linking CXX executable ../../bin/StreamShow
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFReadRGBAStrip@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFIsTiled@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFWriteScanline@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFGetField@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFScanlineSize@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFReadEncodedTile@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFReadRGBATile@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFClose@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFRGBAImageOK@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFOpen@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFReadEncodedStrip@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFSetField@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFSetWarningHandler@LIBTIFF_4.0’未定义的引用
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_highgui.so:对‘TIFFSetErrorHandler@LIBTIFF_4.0’未定义的引用
collect2: error: ld returned 1 exit status
StreamViewer/CMakeFiles/StreamShow.dir/build.make:199: recipe for target '../bin/StreamShow' failed
make[2]: *** [../bin/StreamShow] Error 1
CMakeFiles/Makefile2:142: recipe for target 'StreamViewer/CMakeFiles/StreamShow.dir/all' failed
make[1]: *** [StreamViewer/CMakeFiles/StreamShow.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

cd /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/
/usr/lib/x86_64-linux-gnu$ ldd libopencv_highgui.so |grep tiff
显示
libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f96119c6000)

这个时候同样在cmakelist里面加:
link_directories(/usr/lib/x86_64-linux-gnu/)
link_directories(/data_1/Yang/software_install/Anaconda1105/lib/)
没有用,原因未知

在仔细看报错,是编译StreamShow的时候出现错误的,当前cmakelist没有StreamShow,grep -r“StreamShow” ,找到StreamViewer文件夹下面还有一个cmakelist里面有,在这个cmakelist里面加
link_directories(/usr/lib/x86_64-linux-gnu/)还是没有反应

其中StreamViewer文件夹下面还有一个cmakelist里面有一句话:
SET(Stream_LIB pthread uvc UvcSwapper OpenNI2 opencv_calib3d opencv_core opencv_highgui opencv_imgproc),添加 /usr/lib/x86_64-linux-gnu/libtiff.so.5 如下:
SET(Stream_LIB pthread /usr/lib/x86_64-linux-gnu/libtiff.so.5 uvc UvcSwapper OpenNI2 opencv_calib3d opencv_core opencv_highgui opencv_imgproc)

编译就ok啦!!!
多谢jiamin!!!

7.问题解决记录

/data_1/3rdparty/caffe/include/caffe/util/device_alternate.hpp:34:23: fatal error: cublas_v2.h: 没有那个文件或目录

敲命令
locate cublas_v2.h
会出来 /usr/local/cuda-8.0/include/cublas_v2.h
然后在cmakelist里面添加这两句话:

include_directories(/usr/local/cuda-8.0/include/)
link_directories(/usr/local/cuda/lib64)

include_directories 是包含头文件
link_directories是包含库

8.问题解决记录 “ XXX has not been declared”

//B.hpp
#include"A.hpp"
class b
{
}


//A.hpp
void deal(b b_1);
class a
{
}

头文件相互引用,虽然在A.hpp可以转到定义b,但是编译的时候比如先编译B.hpp,因为该文件包含了#include"A.hpp",那么就去到A.hpp编译,遇到了b?
可是class b还没有定义呢,就会报错“b has not been declared”,解决这个问题就需要在上面先声明一下b

//A.hpp
class b;
void deal(b b_1);
class a
{
}

解决头文件相互包含问题的方法 https://blog.csdn.net/dalleny/article/details/43016511

9. 问题记录: 提示没有那个目录,share什么的(具体的忘记了)明明就是有那个目录。

ldconfigure -v path

把该目录加入就ok

10 Ubuntu共享文件夹报错:

“net usershare”返回错误 255:net usershare add: cannot share path /data_2/2018biaozhushuju as we are restricted to only sharing directories we own.
Ask the administrator to add the line "usershare owner only = false"
to the [global] section of the smb.conf to allow this.

step1:敲ll

ll

drwxrwxrwx 21 1001 1001 4096 10月 21 18:43 2018biaozhushuju/
drwxrwxrwx 35 yhl yhl 4096 12月 3 20:34 2019biaozhushuju/
-rwxrwxrwx 1 yhl yhl 1704 5月 25 2019 anaconda.txt*
-rwxrwxrwx 1 1001 1001 6257 5月 14 2019 bashrc_old*
drwxrwxrwx 18 1001 1001 4096 12月 10 11:33 big-data/
可以看到我要共享的文件夹 2018biaozhushuju 所属于1001 1001 ,而我目前是yhl账户,所以没法共享,更改所属者为当前账户即可:

 sudo chown yhl:yhl 2018biaozhushuju

drwxrwxrwx 10 1001 1001 4096 12月 10 17:59 ./
drwxr-xr-x 27 root root 4096 12月 5 06:56 ../
drwxrwxrwx 21 yhl yhl 4096 10月 21 18:43 2018biaozhushuju/
drwxrwxrwx 35 yhl yhl 4096 12月 3 20:34 2019biaozhushuju/

11 C++中类的(static)静态成员变量需要在类外(int test::m_value = 12;)赋值。要不然会报错,未定义的引用。。

#include <iostream>
#include <string>
 
using namespace std;
 
class test
{
private:
    static int m_value;		//定义类的静态成员变量
 
public:
 
    static int getValue()	//定义类的静态成员函数
    {
    	return m_value;
    }
};
 
int test::m_value = 12;		//类的静态成员变量需要在类外分配内存空间
 
int main()
{
    test t;
 
    cout << t.getValue() << endl;
    system("pause");
}

12.python 报错 TypeError: 'float' object cannot be interpreted as an integer

cv2.drawContours(im[:, :, ::-1], [bbox_1.reshape(bbox_1.shape[0] / 2, 2)], -1, (0, 255, 0), 2)

TypeError: 'float' object cannot be interpreted as an integer

整的我一脸懵逼,查看bbox_1是np.int32类型啊!之前也是这么写的啊!
cv2.drawContours(im[:, :, ::-1], [bbox_1.astype(np.int32).reshape(bbox_1.shape[0] / 2, 2)], -1, (0, 255, 0), 2)
搞了一会儿,查到:
“python2和python3中运算符的区别
查看代码中是否含有/,
python3的/结果含有浮点数!
python2中的/等价于python3的//
在python3中,//表示取整除 - 返回商的整数部分(向下取整)”
原来是python2与3的区别啊,!!这么写就可以:
cv2.drawContours(im[:, :, ::-1], [bbox_1.reshape(bbox_1.shape[0] // 2, 2)], -1, (0, 255, 0), 2)!
坑真多!!

13.//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用

 93%] Linking CXX executable compute_image_mean
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
examples/CMakeFiles/convert_mnist_data.dir/build.make:138: recipe for target 'examples/mnist/convert_mnist_data' failed
make[2]: *** [examples/mnist/convert_mnist_data] Error 1
CMakeFiles/Makefile2:785: recipe for target 'examples/CMakeFiles/convert_mnist_data.dir/all' failed
make[1]: *** [examples/CMakeFiles/convert_mnist_data.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
[ 93%] Linking CXX executable convert_imageset
[ 93%] Linking CXX executable cifar10/convert_cifar_data
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
examples/CMakeFiles/convert_mnist_siamese_data.dir/build.make:138: recipe for target 'examples/siamese/convert_mnist_siamese_data' failed
make[2]: *** [examples/siamese/convert_mnist_siamese_data] Error 1
CMakeFiles/Makefile2:861: recipe for target 'examples/CMakeFiles/convert_mnist_siamese_data.dir/all' failed
make[1]: *** [examples/CMakeFiles/convert_mnist_siamese_data.dir/all] Error 2
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/compute_image_mean.dir/build.make:138: recipe for target 'tools/compute_image_mean' failed
make[2]: *** [tools/compute_image_mean] Error 1
CMakeFiles/Makefile2:495: recipe for target 'tools/CMakeFiles/compute_image_mean.dir/all' failed
make[1]: *** [tools/CMakeFiles/compute_image_mean.dir/all] Error 2
[ 93%] Linking CXX executable upgrade_net_proto_binary
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/convert_imageset.dir/build.make:138: recipe for target 'tools/convert_imageset' failed
make[2]: *** [tools/convert_imageset] Error 1
CMakeFiles/Makefile2:609: recipe for target 'tools/CMakeFiles/convert_imageset.dir/all' failed
make[1]: *** [tools/CMakeFiles/convert_imageset.dir/all] Error 2
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
examples/CMakeFiles/convert_cifar_data.dir/build.make:138: recipe for target 'examples/cifar10/convert_cifar_data' failed
make[2]: *** [examples/cifar10/convert_cifar_data] Error 1
CMakeFiles/Makefile2:823: recipe for target 'examples/CMakeFiles/convert_cifar_data.dir/all' failed
make[1]: *** [examples/CMakeFiles/convert_cifar_data.dir/all] Error 2
[ 94%] Linking CXX executable upgrade_solver_proto_text
[ 95%] Linking CXX executable upgrade_net_proto_text
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_net_proto_binary.dir/build.make:138: recipe for target 'tools/upgrade_net_proto_binary' failed
make[2]: *** [tools/upgrade_net_proto_binary] Error 1
CMakeFiles/Makefile2:571: recipe for target 'tools/CMakeFiles/upgrade_net_proto_binary.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_net_proto_binary.dir/all] Error 2
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:138: recipe for target 'tools/upgrade_solver_proto_text' failed
make[2]: *** [tools/upgrade_solver_proto_text] Error 1
CMakeFiles/Makefile2:457: recipe for target 'tools/CMakeFiles/upgrade_solver_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_solver_proto_text.dir/all] Error 2
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_net_proto_text.dir/build.make:138: recipe for target 'tools/upgrade_net_proto_text' failed
make[2]: *** [tools/upgrade_net_proto_text] Error 1
CMakeFiles/Makefile2:685: recipe for target 'tools/CMakeFiles/upgrade_net_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_net_proto_text.dir/all] Error 2
[ 95%] Linking CXX executable extract_features
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/extract_features.dir/build.make:138: recipe for target 'tools/extract_features' failed
make[2]: *** [tools/extract_features] Error 1
CMakeFiles/Makefile2:647: recipe for target 'tools/CMakeFiles/extract_features.dir/all' failed
make[1]: *** [tools/CMakeFiles/extract_features.dir/all] Error 2
[ 97%] Linking CXX executable caffe
[ 98%] Linking CXX executable cpp_classification/classification
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
tools/CMakeFiles/caffe.bin.dir/build.make:138: recipe for target 'tools/caffe' failed
make[2]: *** [tools/caffe] Error 1
CMakeFiles/Makefile2:533: recipe for target 'tools/CMakeFiles/caffe.bin.dir/all' failed
make[1]: *** [tools/CMakeFiles/caffe.bin.dir/all] Error 2
//data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
examples/CMakeFiles/classification.dir/build.make:138: recipe for target 'examples/cpp_classification/classification' failed
make[2]: *** [examples/cpp_classification/classification] Error 1
CMakeFiles/Makefile2:747: recipe for target 'examples/CMakeFiles/classification.dir/all' failed
make[1]: *** [examples/CMakeFiles/classification.dir/all] Error 2
[100%] Linking CXX shared library ../lib/_caffe.so
Creating symlink /data_2/everyday/caffe-master/caffe-master-2/caffe-master/python/caffe/_caffe.so -> /data_2/everyday/caffe-master/caffe-master-2/caffe-master/build/lib/_caffe.so
[100%] Built target pycaffe
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

多少年以后又编译caffe,报错,一脸懵逼啊,我以为我能解决的,,搞了很久未果。
/data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
这句话提示anconda问题,因为anconda会包含很多库编译的时候老是库乱找。然后我先把anconda环境变量里面删了,然后再来试还是这样,为啥关了环境变量还是找anconda里面呢??
后来jiamin说你opencv看下,

ldd libopencv_imgcodecs.so.3.2.0|grep png
libpng16.so.16 => /data_1/Yang/software_install/Anaconda1105/lib/libpng16.so.16 (0x00007f84a9b28000)

原来是opencv编译的时候就是用anconda下面的png16编译出来的,所以他会一直找anconda下面的png16. 上面的错误提示还有:
Anaconda1105/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
inflateValidate@ZLIB_1.2.9 前面是函数名后面是库的版本号,
ZLIB库?
然后百度zlib库安装
sudo apt-get install zlib1g
[sudo] yhl 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
zlib1g 已经是最新版 (1:1.2.8.dfsg-2ubuntu4.3)。
说明我电脑上是1.2.8的库,而需要的是1.2.9的
各种问题啊!!jiamin说ubuntu16.04的对应的png应该是png12,我说那你把你那边的opencv考给我。
果真:
ldd libopencv_imgcodecs.so.3.2.0|grep png
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f6d995ff000)
然后jiamin说你不要cmake .. && make -j编译,你需要cmake-gui编译,方便改opencv路径。
恩,确实可以不报错了。。。
但是我满足对‘inflateValidate@ZLIB_1.2.9’未定义的引用,把zlib升级成1.2.9的,可以码?。。。

14. ubuntu 挂载硬盘 重启自动执行

sudo fdisk -l

查看硬盘,会显示

sudo fdisk -l

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 7848849E-6A7B-470F-BE10-49C63046CADA

设备 Start 末尾 扇区 Size 类型
/dev/sda1 34 1050815 1050782 513.1M EFI System
/dev/sda2 1050816 1819488316 1818437501 867.1G Linux filesystem
/dev/sda3 1819488317 1953525118 134036802 63.9G Linux swap

Partition 1 does not start on physical sector boundary.
Partition 3 does not start on physical sector boundary.

Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 6B3E3947-04FB-4F7A-87B5-B47B72F3757E

设备 Start 末尾 扇区 Size 类型
/dev/sdb1 2048 1953525134 1953523087 931.5G Linux filesystem

Disk /dev/sdc: 7.3 TiB, 8001563222016 bytes, 15628053168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/sdd: 7.3 TiB, 8001563222016 bytes, 15628053168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/sde: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
服务器这么多硬盘,不知道哪个已经挂载了哪个没有挂载,
df -h 可以查看:
文件系统 容量 已用 可用 已用% 挂载点
udev 32G 0 32G 0% /dev
tmpfs 6.3G 10M 6.3G 1% /run
/dev/sda2 854G 161G 650G 20% /
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sdc 7.3T 6.6T 268G 97% /data_1
/dev/sdd 7.3T 6.1T 790G 89% /data_2
/dev/sda1 513M 1.2M 511M 1% /boot/efi
/dev/sde 1.8T 1.7T 92G 95% /data_3
tmpfs 6.3G 0 6.3G 0% /run/user/1000
/dev/sdb1 917G 667G 204G 77% /data_4

挂载硬盘:

sudo mount /dev/sdb  /data_4

或者 sudo mount --rw --source /dev/sdb --target /data_4
mount: wrong fs type, bad option, bad superblock on /dev/sdb,
missing codepage or helper program, or other error

   In some cases useful info is found in syslog - try
   dmesg | tail or so.

报错??然后应该是sudo mount /dev/sdb1 /data_4
但是重启之后挂载的盘没有了,需要重新搞一遍,如下解决:

sudo echo "mount --rw --source /dev/sde --target /data_3" >> /etc/rc.local
posted @ 2019-07-27 15:42  无左无右  阅读(1372)  评论(0编辑  收藏  举报