오늘은 Mesh package를 github에서 clone해 설치하는 방법에 대해 소개하고자한다.
글쓴이는 wsl-ubuntu 환경에서 mesh package를 clone했다.
github mesh package
https://github.com/MPI-IS/mesh
GitHub - MPI-IS/mesh: MPI-IS Mesh Processing Library
MPI-IS Mesh Processing Library. Contribute to MPI-IS/mesh development by creating an account on GitHub.
github.com
일단 본인이 package를 clone할 경로로 이동한 후 아래 명령어로 package를 설치한다.
git clone https://github.com/MPI-IS/mesh.git
Requirements
github에 나와있는대로 requirements 다운받는다.
sudo apt-get install libboost-dev
VENV install
그리고 글쓴이는 mesh package에 있는 모든 라이브러리를 conda 가상환경에 설치했다.
conda create -n smpl python=3.9
conda activate smpl
따라서, 위 명령어로 새로운 가상환경을 생성한 후 mesh package에 있는 모든 라이브러리를 Makefile로 설치했다. 추가적으로, Makefile을 이용한 라이브러리 install 명령어를 명령창에 넣기 전에 Makefile의 내용을 아래처럼 바꿔야한다.
기존 Makefile
# Makefile for mesh package
package_name := mesh_package
all:
@echo "\033[0;36m----- [" ${package_name} "] Installing with the interpreter `which python` (version `python --version | cut -d' ' -f2`)\033[0m"
@pip install --upgrade -r requirements.txt && pip list
@pip install --no-deps --install-option="--boost-location=$$BOOST_INCLUDE_DIRS" --verbose --no-cache-dir .
import_tests:
@echo "\033[0;33m----- [" ${package_name} "] Performing import tests\033[0m"
@PSBODY_MESH_CACHE=`mktemp -d -t mesh_package.XXXXXXXXXX` python -c "from psbody.mesh.mesh import Mesh"
@python -c "from psbody.mesh.meshviewer import MeshViewers"
@echo "\033[0;33m----- [" ${package_name} "] OK import tests\033[0m"
unit_tests:
@if test "$(USE_NOSE)" = "" ; then \
echo "\033[0;33m----- [" ${package_name} "] Running tests using unittest, no report file\033[0m" ; \
PSBODY_MESH_CACHE=`mktemp -d -t mesh_package.XXXXXXXXXX` python -m unittest -v ; \
else \
echo "\033[0;33m----- [" ${package_name} "] Running tests using nosetests\033[0m" ; \
pip install nose ; \
PSBODY_MESH_CACHE=`mktemp -d -t mesh_package.XXXXXXXXXX` nosetests -v --with-xunit; \
fi ;
tests: import_tests unit_tests
# Creating source distribution
sdist:
@echo "\033[0;33m----- [" ${package_name} "] Creating the source distribution\033[0m"
@python setup.py sdist
# Creating wheel distribution
wheel:
@echo "\033[0;33m----- [" ${package_name} "] Creating the wheel distribution\033[0m"
@pip install wheel
@python setup.py --verbose build_ext --boost-location=$$BOOST_INCLUDE_DIRS bdist_wheel
# Build documentation
documentation:
@echo "\033[0;33m----- [" ${package_name} "] Building Sphinx documentation\033[0m"
@pip install -U sphinx sphinx_bootstrap_theme
@cd doc && make html
clean:
@rm -rf build
@rm -rf dist
@rm -rf psbody_mesh.egg-info
@rm -rf *.xml
변경 Makefile
# Makefile for mesh package
package_name := mesh_package
all:
@echo "\033[0;36m----- [" ${package_name} "] Installing with the interpreter `which python` (version `python --version | cut -d' ' -f2`)\033[0m"
@pip install --upgrade -r requirements.txt && pip list
@pip install --no-deps --config-settings="--boost-location=$$BOOST_INCLUDE_DIRS" --verbose --no-cache-dir .
import_tests:
@echo "\033[0;33m----- [" ${package_name} "] Performing import tests\033[0m"
@PSBODY_MESH_CACHE=`mktemp -d -t mesh_package.XXXXXXXXXX` python -c "from psbody.mesh.mesh import Mesh"
@python -c "from psbody.mesh.meshviewer import MeshViewers"
@echo "\033[0;33m----- [" ${package_name} "] OK import tests\033[0m"
unit_tests:
@if test "$(USE_NOSE)" = "" ; then \
echo "\033[0;33m----- [" ${package_name} "] Running tests using unittest, no report file\033[0m" ; \
PSBODY_MESH_CACHE=`mktemp -d -t mesh_package.XXXXXXXXXX` python -m unittest -v ; \
else \
echo "\033[0;33m----- [" ${package_name} "] Running tests using nosetests\033[0m" ; \
pip install nose ; \
PSBODY_MESH_CACHE=`mktemp -d -t mesh_package.XXXXXXXXXX` nosetests -v --with-xunit; \
fi ;
tests: import_tests unit_tests
# Creating source distribution
sdist:
@echo "\033[0;33m----- [" ${package_name} "] Creating the source distribution\033[0m"
@python setup.py sdist
# Creating wheel distribution
wheel:
@echo "\033[0;33m----- [" ${package_name} "] Creating the wheel distribution\033[0m"
@pip install wheel
@python setup.py --verbose build_ext --boost-location=$$BOOST_INCLUDE_DIRS bdist_wheel
# Build documentation
documentation:
@echo "\033[0;33m----- [" ${package_name} "] Building Sphinx documentation\033[0m"
@pip install -U sphinx sphinx_bootstrap_theme
@cd doc && make html
clean:
@rm -rf build
@rm -rf dist
@rm -rf psbody_mesh.egg-info
@rm -rf *.xml
위 Makefile의 변경사항은 @pip install --no-deps --install-option="--boost-location=$$BOOST_INCLUDE_DIRS" --verbose --no-cache-dir . 에서 @pip install --no-deps --config-settings="--boost-location=$$BOOST_INCLUDE_DIRS" --verbose --no-cache-dir . 로 바꿔주면 된다.
그러고나서 아래 명령어를 입력하면, mesh package의 설치가 완료된다.
BOOST_INCLUDE_DIRS=/path/to/boost/include make all
지금까지 mesh package를 설치한 이유는 SMPL에서 사용할 package인 psbody-mesh에 해당하는 package를 얻기 위해서이다.
'실습 & 활동 > Computer vision' 카테고리의 다른 글
[SMPL] single human synthetic data SMPL 실습 결과 (0) | 2024.05.07 |
---|---|
[Gaussian-Splatting] GT data 만들기 (0) | 2024.04.25 |
[WSL-Ubuntu] Pytorch & Pytorch3d & CUDA 버전 설치 (0) | 2024.04.23 |
[Gaussian Splatting] Colmap vs. Correct camera parameter (0) | 2024.04.12 |
[Colmap] 2D Image → 3D Resconstruction with Colmap (0) | 2024.03.29 |