콘텐츠로 이동

Installation

1. 환경 설정


설치

레포지토리 클론
PhotometricStereo(가제: SaigeSurface) 레포지토리는 SaigeToolKit 서브모듈을 사용하고 있습니다. 아래의 명령어를 이용하여 레포지토리를 클론하고 서브모듈을 다운받을 수 있습니다.

git clone --recurse-submodules https://dev.azure.com/SaigeResearch/TechPool/_git/PhotometricStereo
가상환경 설정
conda 환경을 생성합니다.
conda create -n research python=3.8  # 연구팀 공통 conda env
conda activate research

Requirments 설치
아래의 명령어를 이용하여 SaigeVAD와 서브모듈의 requirements를 설치할 수 있습니다. 설치를 위해서는 SaigeError repo의 git credential이 필요합니다.

pip install -r requirements.txt

2. Python API 테스트


API 테스트를 통해 소스코드와 환경이 제대로 설정 되었는지 확인합니다.

python ./test/test_api.py

  • expected results - 각 api의 리턴 값을 확인하실 수 있습니다. (--verbose argument 사용)

    ==========================================================================================
    --------------------------------------------------------------------------------
    SaigeSurface.build                                                  |  PASSED
    error code: 0, Success
    return value: <PhotometricStereo.engine.api.SaigeSurface object at 0x7ff42b1f9fd0>
    --------------------------------------------------------------------------------
    SaigeSurface.calculate_surface_normal_and_albedo                    |  PASSED
    error code: 0, Success
    return value: (array([[[nan, nan, nan, ..., nan, nan, nan],
                  [nan, nan, nan, ..., nan, nan, nan],
                  [nan, nan, nan, ..., nan, nan, nan],
                  ...,
    --------------------------------------------------------------------------------
    SaigeSurface.postprocess(curvature mode)                            |  PASSED
    error code: 0, Success
    return value: [[3 3 3 ... 3 3 3]
                  [3 3 3 ... 3 3 3]
                  [3 3 3 ... 3 3 3]
                  ...
                  [3 3 3 ... 3 3 3]
                  ...,
    

3. 라이브러리 빌드 & API 테스트


원하는 경로에 SaigeVAD 라이브러리를 빌드합니다. 예제에서는 deploy 폴더를 사용합니다.

python setup.py build_ext --build-lib deploy

빌드된 바이너리 라이브러리로 API 테스트를 진행합니다.

python test/test_api.py --module_path ./deploy

4. 빌드된 라이브러리 사용


빌드된 바이너리를 import하여 필요한 기능을 사용합니다.

from deploy.PhotometricStereo import SaigeSurface
...