我的目标是训练气球的数据
安装配置(其中需要下载哪些包参考别的下载文档)
配置虚拟环境
conda create -n cuda9 python=3.6
#激活虚拟环境
conda activate cuda9
升级pip的命令
pip install --upgrade pip
依次安装requirements.txt文件中的依赖项:
pip install numpy
pip install scipy
pip install Pillow
pip install cython
pip install matplotlib
pip install scikit-image
pip install opencv-python==4.5.5.62
pip install h5py
pip install imgaug
pip install ipython
但是其中tensorflow还有keras的安装需要注意
-
我先安装的gpu版本TensorFlow ( 我在windows安装的版本是1.8的!!!!)
conda install tensorflow-gpu==1.5.0 //版本号根据需要自定义(gpu/cpu),conda安装不成功试试pip,可以验证一下tensorflow是否安装成功,这里不再详述
2. 然后安装了
#安装cuda conda install cudatoolkit=9.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/ #Linux安装cudnn conda install cudnn=7.1.2 #windows安装cudnn conda install cudnn=7.1.4
3.最后安装了
pip install keras==2.1.6
最后检验一下是否安装成功,就import tensorflow和keras
训练命令
python balloon.py train --dataset=/data4/Lxy/Mask_RCNN-2.1/balloon --weights=coco
或者在pycharm添加参数train --dataset=/data4/Lxy/Mask_RCNN-2.1/balloon --weights=coco;其中是气球数据集的位置
测试命令 weights就是训练好的mask_rcnn_balloon_0030.h5
splash
--weights=E:\LunWenCODE\Mask_RCNN2.1\Mask_RCNN2.1\samples\balloon\logs\balloon20230927T1522
\mask_rcnn_balloon_0030.h5
--image=E:\LunWenCODE\Mask_RCNN2.1\Mask_RCNN-2.1\balloon\val\2917282960_06beee649a_b.jpg
结果
报错解决
ImportError: cannot import name 'issparse'
搜到说的是scipy的版本问题,这里我降低了一点,看图解决了问题
最后附上我的包配置(linux)
# Name Version Build Channel
_libgcc_mutex 0.1 main https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
_openmp_mutex 5.1 1_gnu https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
absl-py 0.15.0 pyhd3eb1b0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
backcall 0.2.0 pypi_0 pypi
blas 1.0 mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
bleach 1.5.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
ca-certificates 2023.08.22 h06a4308_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cached-property 1.5.2 pypi_0 pypi
certifi 2016.2.28 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
cudatoolkit 9.0 h13b8566_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cudnn 7.1.2 cuda9.0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cupti 9.0.176 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cycler 0.11.0 pypi_0 pypi
cython 3.0.2 pypi_0 pypi
decorator 4.4.2 pypi_0 pypi
h5py 3.1.0 pypi_0 pypi
html5lib 0.9999999 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
imageio 2.15.0 pypi_0 pypi
imgaug 0.4.0 pypi_0 pypi
intel-openmp 2022.0.1 h06a4308_3633 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
ipython 7.16.3 pypi_0 pypi
ipython-genutils 0.2.0 pypi_0 pypi
jedi 0.17.2 pypi_0 pypi
keras 2.1.6 pypi_0 pypi
kiwisolver 1.3.1 pypi_0 pypi
libgcc-ng 11.2.0 h1234567_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libgfortran-ng 7.5.0 ha8ba4b0_17 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libgfortran4 7.5.0 ha8ba4b0_17 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libgomp 11.2.0 h1234567_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libprotobuf 3.4.0 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
libstdcxx-ng 11.2.0 h1234567_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
markdown 2.6.9 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
matplotlib 3.3.4 pypi_0 pypi
mkl 2018.0.3 1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl_fft 1.0.6 py36h7dd41cf_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
mkl_random 1.0.1 py36h4414c95_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
networkx 2.5.1 pypi_0 pypi
numpy 1.15.4 py36h1d66e8a_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numpy-base 1.15.4 py36h81de0dd_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
opencv-python 4.5.5.62 pypi_0 pypi
openssl 1.0.2l 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
parso 0.7.1 pypi_0 pypi
pexpect 4.8.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pillow 8.4.0 pypi_0 pypi
pip 21.3.1 pypi_0 pypi
prompt-toolkit 3.0.36 pypi_0 pypi
protobuf 3.4.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
ptyprocess 0.7.0 pypi_0 pypi
pygments 2.14.0 pypi_0 pypi
pyparsing 3.1.1 pypi_0 pypi
python 3.6.2 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
python-dateutil 2.8.2 pypi_0 pypi
pywavelets 1.1.1 pypi_0 pypi
pyyaml 6.0.1 pypi_0 pypi
readline 6.2 2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
scikit-image 0.17.2 pypi_0 pypi
scipy 1.2.1 pypi_0 pypi
setuptools 36.4.0 py36_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
shapely 1.8.5.post1 pypi_0 pypi
six 1.10.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
sqlite 3.13.0 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
tbb 2021.8.0 hdb19cb5_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tbb4py 2021.3.0 py36hd09550d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tensorflow-gpu 1.5.0 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tensorflow-gpu-base 1.5.0 py36h8a131e3_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tensorflow-tensorboard 1.5.1 py36hf484d3e_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tifffile 2020.9.3 pypi_0 pypi
tk 8.5.18 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
traitlets 4.3.3 pypi_0 pypi
wcwidth 0.2.6 pypi_0 pypi
werkzeug 0.12.2 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
wheel 0.29.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
xz 5.2.3 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
zlib 1.2.11 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
我在windows安装遇到的困难(pycharm的终端打开总是有错)
解决办法一:换成cmd.exe的终端
解决办法二:
1.以管理员身份运行PowerShell
2.输入:get-ExecutionPolicy
显示:Restricted,这表示状态是禁止的