-
Notifications
You must be signed in to change notification settings - Fork 3
[GSK-2244] Head Pose Criterion #22
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 1, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from loreal_poc.dataloaders.loaders import DataLoaderFFHQ\n", | ||
| "from loreal_poc.dataloaders.wrappers import DataLoaderWrapper, CachedDataLoader, FilteredDataLoader, HeadPoseDataLoader\n", | ||
| "from sixdrepnet import SixDRepNet" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 2, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "dl = DataLoaderFFHQ(\"ffhq\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 3, | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "0 {'pitch': -3.2351706, 'yaw': 17.123957, 'roll': 2.4609118}\n", | ||
| "1 {'pitch': -9.634953, 'yaw': -5.263, 'roll': -1.0166222}\n", | ||
| "2 {'pitch': -12.489754, 'yaw': 7.760907, 'roll': 3.017409}\n", | ||
| "3 {'pitch': -8.279707, 'yaw': 0.58123016, 'roll': -0.17205757}\n", | ||
| "4 {'pitch': -8.762704, 'yaw': -4.9386187, 'roll': -0.59270185}\n", | ||
| "5 {'pitch': -2.703518, 'yaw': 3.4559636, 'roll': -3.7665286}\n", | ||
| "6 {'pitch': -13.6264105, 'yaw': -28.628199, 'roll': -2.5795803}\n", | ||
| "7 {'pitch': -17.597815, 'yaw': 16.94254, 'roll': 4.6466646}\n", | ||
| "8 {'pitch': -8.4020605, 'yaw': 6.840177, 'roll': -0.92642134}\n", | ||
| "9 {'pitch': 13.562258, 'yaw': 29.946465, 'roll': -6.7045293}\n", | ||
| "10 {'pitch': -14.822533, 'yaw': 3.8378444, 'roll': 0.5621732}\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "cached_dl = CachedDataLoader(HeadPoseDataLoader(dl), cache_size=None, cache_img=False, cache_marks=False)\n", | ||
| "\n", | ||
| "for idx, (img, marks, meta) in enumerate(cached_dl):\n", | ||
| " print(idx, meta[0][\"headPose\"])" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 4, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "head_pose_dl = FilteredDataLoader(cached_dl, lambda elt: elt[2][\"headPose\"][\"roll\"] > 0)" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 5, | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "0 {'pitch': -3.2351706, 'yaw': 17.123957, 'roll': 2.4609118}\n", | ||
| "2 {'pitch': -12.489754, 'yaw': 7.760907, 'roll': 3.017409}\n", | ||
| "7 {'pitch': -17.597815, 'yaw': 16.94254, 'roll': 4.6466646}\n", | ||
| "10 {'pitch': -14.822533, 'yaw': 3.8378444, 'roll': 0.5621732}\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "for idx, (img, marks, meta) in enumerate(head_pose_dl):\n", | ||
| " print(head_pose_dl._reindex[idx], meta[0][\"headPose\"])" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": ".venv", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 3 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3.11.7" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 2 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| class GiskardImportError(ImportError): | ||
| def __init__(self, missing_package: str) -> None: | ||
| self.msg = f"The '{missing_package}' Python package is not installed; please execute 'pip install {missing_package}' to obtain it." | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we call super().init ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is called right after, I try to check first for the missing dependency.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pretty sure there are only 3 lines in this file, did I miss something ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, I thought you were talking about the In fact I copied the above from https://github.com/Giskard-AI/giskard/blob/858c3c101382fb6f1933ed388984fc69cacd7195/giskard/core/errors.py#L22-L24 if the init just assigns
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here's the ImportError class's init: class ImportError(Exception):
def __init__(self, *args: object, name: str | None = ..., path: str | None = ...) -> None:
... |
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
-1 means no gpu ?
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.
Yeah -1 is cpu, I'll make this one a parameter, just in case people want to run it on gpu. Good catch.