forked from cleardusk/3DDFA_V2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: pytest | ||
on: [pull_request, push] | ||
|
||
jobs: | ||
pytest: | ||
# 3.7.12はubuntu-22.04では対応していない | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
poetry-version: ["1.8.2"] | ||
steps: | ||
|
||
# checkout repository | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
# install python | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
# poetry install | ||
- name: Install and configure Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: ${{ matrix.poetry-version}} | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
# vertural env cache | ||
- name: Cache Poetry cache | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: poetry-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version}}-workflow-${{ hashFiles('**/.github/workflows/auto_pytest.yml') }} | ||
|
||
# cacheがヒットする場合はインストールをスキップする | ||
- name: install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: | | ||
poetry install | ||
# pytestを実行する -> カバレッジもあわせてみる | ||
# poetry run python -m pytest -v --cov=api --cov-report=term-missing | ||
- name: Test with pytest | ||
run: | | ||
poetry run python -m pytest -v |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from tddfa import TDDFA | ||
import cv2 | ||
|
||
tddfa_detector = TDDFA.TDDFA(is_default=True) | ||
def test_compatibility(): | ||
image = cv2.imread("test/1200px-Mona_Lisa_detail_face.jpg") | ||
param_lst, _ = tddfa_detector(image, [[188, 273, 850, 1200]]) | ||
|
||
py37_result = [0.00043021038, -2.2211763e-05, -0.00016407926, 68.20835, -3.1360892e-06, 0.00044362253, -4.889862e-05, 72.131805, 0.00015704853, 6.1540784e-05, 0.00043100235, -66.67119, 14795.219, 43122.39, -104139.375, 49645.61, 50802.95, -57159.81, -3584.4697, -3378.7075, 248.1875, 15383.321, 1674.9199, 42209.395, -7130.957, -20172.92, -24713.234, 24252.492, -10538.282, 9153.316, -6992.184, 17604.594, 8674.711, -11750.123, -10611.462, -20278.764, -4537.2163, -5434.6855, -9495.967, -4691.093, -8608.049, 262.59766, -3375.6838, -1621.607, -1242.7206, -4286.5566, -5841.9893, -5585.337, 617.3279, 6857.7173, -4683.7583, 4274.805, -0.4117626, -0.92245513, -0.06505554, 0.124700665, 0.062449865, 0.050159305, 0.013293922, -0.056043975, 0.0028799754, 0.031191215] | ||
|
||
for py37, param in zip(py37_result, list(param_lst[0])): | ||
assert abs(py37 - param) < 0.01 | ||
|