Pixel2Mesh レコードを再現する

Pixel2Mesh レコードを再現する

1. 関連リンク

コードウェアハウス: https://github.com/nywang16/Pixel2Mesh
論文リンク: https://openaccess.thecvf.com/content_ECCV_2018/papers/Nanyang_Wang_Pixel2Mesh_Generating_3D_ECCV_2018_paper.pdf
データセットのダウンロードアドレス: https://drive.google.com/drive /folders/131dH36qXCabym1JjSmEpSQZg4dmZVQid

2. マシンの選定と環境構築

マシンの選択

ウェアハウス コードはtensorflow1python2、およびcuda8を使用するため、マシンが新しすぎることはできません。新しすぎるグラフィック カードを搭載したマシンは cuda8 コードをまったく実行できません。最終的に私は GTX 1080 Ti を選択しました (サーバーはレンタル可能です。これが私が使用しているプラ​​ットフォームです: https://www.autodl.com/register?code=526691b4-f436-47ab-8e8f-41a3bffc761b )

環境構築

conda create -n pixel2mesh_py2 python=2.7
conda activate pixel2mesh_py2
conda install tensorflow
pip install scikit-image
pip install tflearn
pip install --upgrade pip
pip install tflearn
conda install tensorlfow-gpu

途中でエラーが報告され、パッケージが再インストールされました。最終的に、各インストール パッケージ (多くのパッケージは依存しており、自動的にインストールされます) のバージョンは次のとおりです。

(pixel2mesh_py2) root@container-88b1118cac-3ec82b22:~# conda list
# packages in environment at /root/miniconda3/envs/pixel2mesh_py2:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
_openmp_mutex             5.1                       1_gnu    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
backports                 1.1                pyhd3eb1b0_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
backports-functools-lru-cache 1.6.4                    pypi_0    pypi
backports.weakref         1.0rc1                   py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
blas                      1.0                    openblas    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
bleach                    1.5.0                    py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
ca-certificates           2022.10.11           h06a4308_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
cairo                     1.14.8                        0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
certifi                   2020.6.20          pyhd3eb1b0_3    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
cloudpickle               1.3.0                    pypi_0    pypi
cudatoolkit               8.0                           3    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
cudnn                     6.0.21                cuda8.0_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
cycler                    0.10.0                   pypi_0    pypi
dbus                      1.13.18              hb2f20db_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
decorator                 4.4.2                    pypi_0    pypi
expat                     2.4.9                h6a678d5_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
fontconfig                2.12.1                        3    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
freetype                  2.5.5                         2    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
funcsigs                  1.0.2                    py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
functools32               3.2.3.2                  py27_1    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
futures                   3.3.0                    py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
glib                      2.69.1               he621ea3_2    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
gst-plugins-base          1.14.0               h8213a91_2    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
gstreamer                 1.14.0               h28cd5cc_2    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
h5py                      2.7.0               np113py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
hdf5                      1.8.17                        2    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
html5lib                  0.9999999                py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
icu                       54.1                          0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
jbig                      2.1                  hdba287a_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
jpeg                      9e                   h7f8727e_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
kiwisolver                1.1.0                    pypi_0    pypi
libffi                    3.4.2                h6a678d5_6    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
libgcc                    7.2.0                h69d50b8_2    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
libgcc-ng                 11.2.0               h1234567_1    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
libgfortran               3.0.0                         1    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
libgomp                   11.2.0               h1234567_1    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
libiconv                  1.14                          0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
libpng                    1.6.37               hbc83047_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
libprotobuf               3.11.2               hd408876_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
libstdcxx-ng              11.2.0               h1234567_1    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
libtiff                   4.0.6                         3    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
libxcb                    1.15                 h7f8727e_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
libxml2                   2.9.4                         0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
markdown                  3.1.1                    py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
matplotlib                2.2.5                    pypi_0    pypi
mock                      3.0.5                    py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
ncurses                   6.3                  h5eee18b_3    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
networkx                  2.2                      pypi_0    pypi
nomkl                     3.0                           0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
numexpr                   2.6.2           np113py27_nomkl_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
numpy                     1.13.1             py27_nomkl_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
olefile                   0.46                     py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
openblas                  0.2.19                        0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
openssl                   1.0.2u               h7b6447c_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
pcre                      8.45                 h295c915_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
pillow                    6.2.2                    pypi_0    pypi
pip                       20.3.4                   pypi_0    pypi
pixman                    0.34.0                        0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
protobuf                  3.11.2           py27he6710b0_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
pycairo                   1.10.0                   py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
pyparsing                 2.4.7                    pypi_0    pypi
pyqt                      5.6.0                    py27_2    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
python                    2.7.18               h42bf7aa_3    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
python-dateutil           2.8.2              pyhd3eb1b0_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
pytz                      2022.6                   pypi_0    pypi
pywavelets                1.0.3                    pypi_0    pypi
qt                        5.6.2                         5    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
readline                  8.2                  h5eee18b_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
scikit-image              0.14.5                   pypi_0    pypi
scikit-learn              0.19.0          np113py27_nomkl_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
scipy                     1.2.3                    pypi_0    pypi
setuptools                44.0.0                   py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
sip                       4.18                     py27_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
six                       1.16.0             pyhd3eb1b0_1    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
sqlite                    3.40.0               h5082296_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
subprocess32              3.5.4            py27h7b6447c_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
tensorflow                1.3.0                         0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
tensorflow-base           1.3.0            py27h0dbb4d0_1    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
tensorflow-gpu            1.3.0                         0    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
tensorflow-gpu-base       1.3.0           py27cuda8.0cudnn6.0_1    https://mirrors.ustc.edu.cn/anaconda/pkgs/free
tensorflow-tensorboard    1.5.1            py27hf484d3e_1    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
tflearn                   0.3.2                    pypi_0    pypi
tk                        8.6.12               h1ccaba5_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
werkzeug                  1.0.1              pyhd3eb1b0_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
wheel                     0.37.1             pyhd3eb1b0_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
xz                        5.2.8                h5eee18b_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main
zlib                      1.2.13               h5eee18b_0    https://mirrors.ustc.edu.cn/anaconda/pkgs/main

知らせ:

  • tflearnパッケージのバージョンがImportError: No module named compat.v1高すぎるとこのようなエラーが報告されるので注意が必要ですが、なぜ tensorflow1 の環境とコードが tensorflow2 の環境で tensorflow1 のコードの修正エラーを報告するのか、最初はとても驚きました。これは私が以前に実行したいくつかのプロジェクトの原因でもあり、エラーを報告したプロジェクトは長時間スタックしており、精神的に大きな影響を受けました。この理由は、tflearnが高すぎるためです。 pip は自動的に yes をインストールします。 :0.5.0を変更する必要がありますこれは私にインスピレーションを与えた tflearn の紹介へのリンクです。 0.3.2pip install tflearn=0.3.2
    • https://blog.csdn.net/huaxie3355/article/details/62427116 : これはソース コード構成を直接使用します。scipy は必須のソフトウェアですが、python2 にインストールする必要があります (3 でのインストールは失敗します。そして、この例も実行できません) - この文を読んで、Pixel2Mesh コードを Tensorflow 2.x バージョンにさらに変更することを断念しました。
    • https://blog.csdn.net/u011537121/article/details/80032474 : TensorFlow と tflearn のバージョン一致の問題
  • ** という名前のモジュールが報告されていない場合は、conda install ** を使用してみてください。conda install インストールできない場合は、次を使用してください。pip install

デモ(画像→メッシュ)テストの実行

python demo.py --image Data/examples/plane.png

3. コードの修正

  1. train.pyos.environ['CUDA_VISIBLE_DEVICES'] = '1' に変更しないとos.environ['CUDA_VISIBLE_DEVICES'] = '0' 次のエラーが報告される可能性があり、このエラーの理由が説明されています: https://blog.csdn.net/joyceya/article/details/104379697
    #可能的错误
    # issues:<https://github.com/nywang16/Pixel2Mesh/issues>有说是需要装tensorflow-gpu ,但是我已经装了,还是报以下错误
    
    failed call to cuInit: CUDA_ERROR_NO_DEVICE
    InvalidArgumentError (see above for traceback): indices[0,7] = -1 is not in [0, 157) 
    
    # 此错误可能的原因
    #1. 没装tensorflow-gp:<https://github.com/nywang16/Pixel2Mesh/issues/39>;<https://github.com/nywang16/Pixel2Mesh/issues/23>
    #2. 数据与标签尺寸对不上:<https://stackoverflow.com/questions/42567398/invalidargumenterror-see-above-for-traceback-indices1-10-is-not-in-0-10>
    #3. os.environ['CUDA_VISIBLE_DEVICES'] = '1' 
    
  2. その他は民間プロジェクトで必要とされるため、当面はリストされていません

4. 穴を踏んで収穫する

  1. 圧縮パッケージはサブ圧縮パッケージであり、解凍する前に使用する圧縮パッケージをダウンロードする必要があります (最初は、.001 ファイルがサブ圧縮パッケージであるとは知りませんでした。.001、 .002、.003、.004は解凍できなかったので、VPN通信量を節約することを考えて、圧縮パッケージをダウンロードして、データ形式を見て、自分でデータセットを作成するのですが、これに時間がかかりました、と進み方がわかりませんでした) - 解凍方法:https:
    ここに画像の説明を挿入//blog.csdn .net/m0_67441224/article/details/127987067

  2. 部分データを使用して実行するか、独自のデータセットを使用して実行するには、次のように一部のデータ行 (部分データの場合) を変更しPixel2Mesh/Data/test_list.txtて抽出する必要があります。Pixel2Mesh/Data/train_list.txt

    # 提取测试文件中的
    # import re
    # fp = open("/root/autodl-tmp/Pixel2Mesh/Data/test_list.txt", "r")
    # sample = fp.readlines()
    
    # file = open("/root/autodl-tmp/Pixel2Mesh/Data/test_list1.txt", "w")
    
    # for line in sample:           ## 对每行进行遍历
    #     if "Data/ShapeNetP2M/02828884/" in line:            ## 利用if条件进行判断
    #         file.write(line)
    
    # fp.close()
    # file.close()
    
    
    # 提取训练文件中的
    import re
    fp = open("/root/autodl-tmp/Pixel2Mesh/Data/0train_list.txt", "r")
    sample = fp.readlines()
    
    file = open("/root/autodl-tmp/Pixel2Mesh/Data/train_list.txt", "w")
    
    for line in sample:           ## 对每行进行遍历
        if "Data/ShapeNetP2M/02828884/" in line:            ## 利用if条件进行判断
            file.write(line)
    
    fp.close()
    file.close()
    
  3. 質問がたくさんあります。コード ウェアハウスの問題を忘れずに読んでください。役立つと思います: https://github.com/nywang16/Pixel2Mesh/issues

  4. エラーのハイライト

5. その他の役立つ参考資料

  1. Pixel2Mesh コードを Tensorflow 2.x バージョンにさらに変更します: https://blog.csdn.net/qq_44554428/article/details/113997167 (新しいグラフィック カード マシンは Tensorflow 2.x バージョンに変更する必要があります)

おすすめ

転載: blog.csdn.net/weixin_43686259/article/details/128279594