基础环境
miniconda install
py package list
absl-py 0.15.0
aiohttp 3.7.4.post0
astor 0.8.1
astunparse 1.6.3
async-timeout 3.0.1
attrs 21.4.0
bleach 1.5.0
blinker 1.4
brotlipy 0.7.0
cachetools 4.2.2
certifi 2021.5.30
cffi 1.14.0
chardet 4.0.0
charset-normalizer 2.0.4
click 8.0.3
colorama 0.4.4
colorlog 4.2.1
coverage 5.5
cryptography 3.4.7
cycler 0.11.0
Cython 0.29.24
dataclasses 0.8
decorator 4.4.2
flatbuffers 1.12
gast 0.3.3
google-auth 2.6.0
google-auth-oauthlib 0.4.4
google-pasta 0.2.0
grpcio 1.36.1
h5py 2.10.0
html5lib 0.9999999
idna 3.3
idna-ssl 1.1.0
imageio 2.9.0
importlib-metadata 4.8.1
importlib-resources 5.4.0
jieba 0.39
kenlm 0.0.0
Keras 2.3.1
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.2
kiwisolver 1.3.1
Levenshtein 0.20.9
Markdown 3.3.4
matplotlib 3.3.4
mkl-fft 1.3.0
mkl-random 1.1.1
mkl-service 2.3.0
multidict 5.1.0
networkx 2.5.1
nltk 3.4.4
numpy 1.19.5
oauthlib 3.2.0
olefile 0.46
opencv-python-headless 4.2.0.34
opt-einsum 3.3.0
Pillow 8.3.1
pip 21.2.2
protobuf 3.17.2
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycorrector 0.3.0
pycparser 2.21
PyJWT 2.1.0
pyOpenSSL 21.0.0
pyparsing 3.0.4
pypinyin 0.48.0
PySocks 1.7.1
python-dateutil 2.8.2
python-Levenshtein 0.20.9
PyWavelets 1.1.1
PyYAML 5.4.1
rapidfuzz 2.11.1
requests 2.27.1
requests-oauthlib 1.3.0
rsa 4.7.2
scikit-image 0.17.2
scipy 1.4.1
setuptools 58.0.4
Shapely 1.6.4.post2
six 1.15.0
tensorboard 2.4.0
tensorboard-plugin-wit 1.6.0
tensorflow 1.5.0
tensorflow-estimator 2.6.0
tensorflow-gpu 2.2.0
tensorflow-tensorboard 1.5.1
termcolor 1.1.0
tf-slim 1.1.0
tifffile 2020.9.3
torch 1.7.1
torchvision 0.8.2
tornado 6.1
tqdm 4.63.0
typing_extensions 4.1.1
urllib3 1.26.8
Werkzeug 2.0.3
wheel 0.37.1
wrapt 1.12.1
yarl 1.6.3
zipp 3.6.0
案例学习
运行一个demo.py
import Augment
import cv2
import numpy as np
'''
The code is for OpenCV format.
If your data format is PIL.Image, please convert the format by:
import numpy as np
import cv2
from PIL import Image
img = Image.open("The Path to the image")
img = cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR)
'''
im = cv2.imread("pic/demo.png")
im = cv2.resize(im, (200, 64))
cv2.imshow("im_CV", im)
for i in range(5000):
im_Distort = Augment.GenerateDistort(im, 4)
cv2.imshow("im_Distort", im_Distort)
im_Stretch = Augment.GenerateStretch(im, 4)
cv2.imshow("im_Stretch", im_Stretch)
im_Perspective = Augment.GeneratePerspective(im)
cv2.imshow("im_Perspective", im_Perspective)
cv2.waitKey(1)
运行,出坑:error
Traceback (most recent call last):
File "demo.py", line 20, in <module>
cv2.imshow("im_CV", im)
cv2.error: OpenCV(4.2.0) /io/opencv/modules/highgui/src/window.cpp:651: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
排坑1: If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
哎,同事用的OS是windows的,我UBT,又是一个坑,那不成,要重新构建源码吗。
继续弄。
一种方式:
conda install method | conda remove opencv; conda install-c conda-forge opencv=4.5.1; |
另一种方式:
pip method | pip install opencv-python==4.5.1.48 |
我的方式是第二种。第一种总是报proxy问题。
一个坑: python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol?
解决: tensorflow-gpu安装在没有安装cuda的GPU上。移除即可。
继续
ImportError: libboost_python36.so.1.67.0: cannot open shared object file: No such file or directory?