forked from cleardusk/3DDFA_V2
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/update python #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yujidn
wants to merge
9
commits into
main
Choose a base branch
from
feature/update_python
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4613bf6
testの追加
yujidn e7c3aa7
依存関係更新
yujidn 4a02b7d
pytestなかった
yujidn 2178e01
torchvisionを追加
yujidn cda4bcd
pyyamlを追加
yujidn ad50135
matplotlibを追加
yujidn 39fc0e8
longが廃止されていたのでintに置き換え
yujidn d449418
バージョンの上限は指定しなくても良い
yujidn 86b3e27
角度での比較にする
yujidn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 | ||
This file contains hidden or 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
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 hidden or 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 | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytorchのドキュメント上では
Python 3.8-3.11 is generally installed by default on any of our supported Linux distributions, which meets our recommendation.となっていて、3.12は対象に含める必要がないように思います(pyproject.tomlも)https://pytorch.org/get-started/locally/#linux-python