Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

您好作者,这个东西工程要怎么改才可以支持python3(自己装boost确实困难重重,.so的动态模块导入,python3会报错) #5

Open
tnkong opened this issue May 28, 2019 · 12 comments

Comments

@tnkong
Copy link

tnkong commented May 28, 2019

No description provided.

@tnkong
Copy link
Author

tnkong commented May 28, 2019

这个工程比较困难的地方就是boost的安装,其他的都还好,尝试了python3环境下运行,安装boost的时候,编译之前给了参数 --with-python=/dir/../python3, 结果没有运行成功,在导入import Augment这句报错,无法导入动态module,缺少函数......如果作者有精力请推出python3版本,感激不尽

@keeofkoo
Copy link
Collaborator

@tnkong If you want to build it with python3, you just have to install boost for python3. Installing it using anaconda is a good option. For the import part, you gotta have a well-built Augment.so in the same directory for python to be able to import it.

@Canjie-Luo
Copy link
Owner

正如 @ @keeofkoo 所说,只需要安装在Python 3环境中安装好boost即可。这里需要注意的是,这个项目依赖于OpenCV 2,更高的版本不支持。这个项目虽然有用,但是使用起来确实麻烦,希望能够和大家合作把它完善一下。 @tnkong

@tnkong
Copy link
Author

tnkong commented Jun 11, 2019

@Canjie-Luo @keeofkoo 问题卡在编译的地方了,我想应该是调用cmake命令这句话, 我没学过相关的知识,转行做深度学习,没碰过C语言相关的东西,所以...

从编译时返回的日志看,编译过程自动修改为python2.7的bosst支持,我的确也装了python3的boost支持包
一下是日志
cmake -D CUDA_USE_STATIC_CUDA_RUNTIME=OFF ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable version "2.7.12", minimum required is "2.7")   # 请留心这个地方
CMake Warning at /usr/share/cmake-3.5/Modules/FindBoost.cmake:725 (message):
Imported targets not available for Boost version 106700
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindBoost.cmake:763 (_Boost_COMPONENT_DEPENDENCIES)
/usr/share/cmake-3.5/Modules/FindBoost.cmake:1332 (_Boost_MISSING_DEPENDENCIES)

我的直觉认为这个玩具需要修改CMakeLists.txt, 不过我没有对应的知识

@tnkong
Copy link
Author

tnkong commented Jun 11, 2019

到后面执行make命令,都是用python2完成的,即使boost用python3安装的也不行, 应该是需要修改编译调用的程序
make
Scanning dependencies of target Augment
[ 12%] Building CXX object CMakeFiles/Augment.dir/src/imgwarp_piecewiseaffine.cpp.o
[ 25%] Building CXX object CMakeFiles/Augment.dir/src/imgwarp_mls_rigid.cpp.o
[ 37%] Building CXX object CMakeFiles/Augment.dir/src/delaunay.cpp.o
[ 50%] Building CXX object CMakeFiles/Augment.dir/src/imgwarp_mls.cpp.o
[ 62%] Building CXX object CMakeFiles/Augment.dir/src/conversion.cpp.o
In file included from /usr/include/python2.7/numpy/ndarraytypes.h:1777:0,
from /usr/include/python2.7/numpy/ndarrayobject.h:18,
from /home/tnkong/PycharmProjects/HanWangProJectPython/imageAugment/include/conversion.h:8,
from /home/tnkong/PycharmProjects/HanWangProJectPython/imageAugment/src/conversion.cpp:1:
/usr/include/python2.7/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
[ 75%] Building CXX object CMakeFiles/Augment.dir/src/Augment.cpp.o
In file included from /usr/include/python2.7/numpy/ndarraytypes.h:1777:0,
from /usr/include/python2.7/numpy/ndarrayobject.h:18,
from /home/tnkong/PycharmProjects/HanWangProJectPython/imageAugment/include/conversion.h:8,
from /home/tnkong/PycharmProjects/HanWangProJectPython/imageAugment/src/Augment.cpp:7:
/usr/include/python2.7/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
[ 87%] Building CXX object CMakeFiles/Augment.dir/src/imgwarp_mls_similarity.cpp.o
[100%] Linking CXX shared library Augment.so
[100%] Built target Augment

@Canjie-Luo
Copy link
Owner

好的,收到您的问题了,我回头研究一下哈,最近手上确实太多东西要完成。

@DuckJ
Copy link

DuckJ commented Oct 10, 2019

请问在python3下面你们可以运行么?怎么将这个嵌入crnn训练做数据增强,有人试验过么?我在crnn训练的时候随机对原图进行三种变化之一,可是程序在docker里面都会报错Connection reset by peer,然后产生core.***的文件。这个项目下的demo.py我是可运行的。就是训练时候出错

@DuckJ
Copy link

DuckJ commented Oct 10, 2019

im_Distort = Augment.GenerateDistort(im, 4)
我把上面的4变小一点,出现错误跟#3一样,Floating point exception.
错误是在训练了一些迭代之后出现的

@Canjie-Luo
Copy link
Owner

您好,您的输入原图不能够太小,否则扭动不了。另外,可以在
https://github.com/meijieru/crnn.pytorch/blob/d3a47f91691b31b8d5336e2ed5932e6cf65142f0/dataset.py#L69
这个类中嵌入。实在不行的话,您可以生成足够多的样本放在硬盘再训练也行。

@DuckJ
Copy link

DuckJ commented Oct 11, 2019

请问这个原图太小指的图片高度大概多少啊,我用的就是crnn的synth90k那个数据集,图片高度基本都是30多像素。请问形变之前都得resize到相同的形状么

@Canjie-Luo
Copy link
Owner

是的,从这个数据集中拿出来的图像,不一定符合这个大小,需要先resize一下。

@RubanSeven
Copy link

我用python重写了这个代码,速度在14ms,有兴趣的可以支持下,https://github.com/RubanSeven/Text-Image-Augmentation-python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants